Commit ce7c4726 authored by Salvatore Sanfilippo's avatar Salvatore Sanfilippo
Browse files

Merge pull request #1764 from michael-grunder/lua_cache_segfault

Fix LUA_OBJCACHE segfault.
parents 01e3f9ba ea0e2524
...@@ -237,7 +237,9 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) { ...@@ -237,7 +237,9 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) {
if (obj_s == NULL) break; /* Not a string. */ if (obj_s == NULL) break; /* Not a string. */
/* Try to use a cached object. */ /* Try to use a cached object. */
if (cached_objects[j] && cached_objects_len[j] >= obj_len) { if (j < LUA_CMD_OBJCACHE_SIZE && cached_objects[j] &&
cached_objects_len[j] >= obj_len)
{
char *s = cached_objects[j]->ptr; char *s = cached_objects[j]->ptr;
struct sdshdr *sh = (void*)(s-(sizeof(struct sdshdr))); struct sdshdr *sh = (void*)(s-(sizeof(struct sdshdr)));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment