From 3df2ab673c9d4aa605777b9536fc45afcf0840da Mon Sep 17 00:00:00 2001 From: michael-grunder Date: Fri, 11 Jul 2014 13:03:26 -0700 Subject: [PATCH] Fix OBJECT arity Previously, the command definition for the OBJECT command specified a minimum of two args (and that it was variadic), which meant that if you sent this: OBJECT foo When cluster was enabled, it would result in an assertion/SEGFAULT when Redis was attempting to extract keys. It appears that OBJECT is not variadic, and only ever takes 3 args. https://gist.github.com/michael-grunder/25960ce1508396d0d36a --- src/object.c | 2 +- src/redis.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/object.c b/src/object.c index bec5ec47..96747fa1 100644 --- a/src/object.c +++ b/src/object.c @@ -608,7 +608,7 @@ robj *objectCommandLookupOrReply(redisClient *c, robj *key, robj *reply) { } /* Object command allows to inspect the internals of an Redis Object. - * Usage: OBJECT ... arguments ... */ + * Usage: OBJECT */ void objectCommand(redisClient *c) { robj *o; diff --git a/src/redis.c b/src/redis.c index cf4cc177..7fb009ac 100644 --- a/src/redis.c +++ b/src/redis.c @@ -258,7 +258,7 @@ struct redisCommand redisCommandTable[] = { {"restore",restoreCommand,4,"awm",0,NULL,1,1,1,0,0}, {"migrate",migrateCommand,6,"aw",0,NULL,0,0,0,0,0}, {"dump",dumpCommand,2,"ar",0,NULL,1,1,1,0,0}, - {"object",objectCommand,-2,"r",0,NULL,2,2,2,0,0}, + {"object",objectCommand,3,"r",0,NULL,2,2,2,0,0}, {"client",clientCommand,-2,"ar",0,NULL,0,0,0,0,0}, {"eval",evalCommand,-3,"s",0,zunionInterGetKeys,0,0,0,0,0}, {"evalsha",evalShaCommand,-3,"s",0,zunionInterGetKeys,0,0,0,0,0},