From 7a6cfb18f31b18303e822ce3ad887fdf8c2138e9 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Tue, 10 Jul 2012 15:51:43 -0700 Subject: [PATCH] SCAN requires at least 1 argument --- src/db.c | 2 ++ src/redis.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/db.c b/src/db.c index 32d539f6..ce69d58b 100644 --- a/src/db.c +++ b/src/db.c @@ -337,6 +337,8 @@ void scanCommand(redisClient *c) { sds pat; int patlen, patnoop = 1; + redisAssert(c->argc >= 2); + /* Use sscanf because we need an *unsigned* long */ rv = sscanf(c->argv[1]->ptr, "%lu", &cursor); if (rv != 1) { diff --git a/src/redis.c b/src/redis.c index 6e5181e1..04313f2f 100644 --- a/src/redis.c +++ b/src/redis.c @@ -210,7 +210,7 @@ struct redisCommand redisCommandTable[] = { {"pexpire",pexpireCommand,3,"w",0,NULL,1,1,1,0,0}, {"pexpireat",pexpireatCommand,3,"w",0,NULL,1,1,1,0,0}, {"keys",keysCommand,2,"rS",0,NULL,0,0,0,0,0}, - {"scan",scanCommand,-1,"RS",0,NULL,0,0,0,0,0}, + {"scan",scanCommand,-2,"RS",0,NULL,0,0,0,0,0}, {"dbsize",dbsizeCommand,1,"r",0,NULL,0,0,0,0,0}, {"auth",authCommand,2,"rslt",0,NULL,0,0,0,0,0}, {"ping",pingCommand,1,"rt",0,NULL,0,0,0,0,0},