From 3758f27bc1d3be0b12676fa9a7f26678e4789c6c Mon Sep 17 00:00:00 2001 From: antirez Date: Wed, 4 Jun 2014 18:57:12 +0200 Subject: [PATCH] Fixed dbuf variable scope in luaRedisGenericCommand(). I'm not sure if while the visibility is the inner block, the fact we point to 'dbuf' is a problem or not, probably the stack var isx guaranteed to live until the function returns. However obvious code is better anyway. --- src/scripting.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripting.c b/src/scripting.c index 2a7f1b91..27964771 100644 --- a/src/scripting.c +++ b/src/scripting.c @@ -232,11 +232,11 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) { for (j = 0; j < argc; j++) { char *obj_s; size_t obj_len; + char dbuf[64]; if (lua_isnumber(lua,j+1)) { /* We can't use lua_tolstring() for number -> string conversion * since Lua uses a format specifier that loses precision. */ - char dbuf[64]; lua_Number num = lua_tonumber(lua,j+1); obj_len = snprintf(dbuf,sizeof(dbuf),"%.17g",(double)num);