mirror of
https://github.com/fluencelabs/redis
synced 2025-06-12 16:51:22 +00:00
Fix issue #247 : Accepting non-integer parameters when shouldn't
Using `getLongFromObjectOrReply` instead of `atoi` if possible. The following functions are modified. * lrangeCommand * ltrimCommand * lremCommand * lindexCommand * lsetCommand * zunionInterGenericCommand * genericZrangebyscoreCommand * sortCommand
This commit is contained in:
@ -133,7 +133,7 @@ void sortCommand(redisClient *c) {
|
||||
list *operations;
|
||||
unsigned int outputlen = 0;
|
||||
int desc = 0, alpha = 0;
|
||||
int limit_start = 0, limit_count = -1, start, end;
|
||||
long limit_start = 0, limit_count = -1, start, end;
|
||||
int j, dontsort = 0, vectorlen;
|
||||
int getop = 0; /* GET operation counter */
|
||||
robj *sortval, *sortby = NULL, *storekey = NULL;
|
||||
@ -172,8 +172,8 @@ void sortCommand(redisClient *c) {
|
||||
} else if (!strcasecmp(c->argv[j]->ptr,"alpha")) {
|
||||
alpha = 1;
|
||||
} else if (!strcasecmp(c->argv[j]->ptr,"limit") && leftargs >= 2) {
|
||||
limit_start = atoi(c->argv[j+1]->ptr);
|
||||
limit_count = atoi(c->argv[j+2]->ptr);
|
||||
if ((getLongFromObjectOrReply(c, c->argv[j+1], &limit_start, NULL) != REDIS_OK) ||
|
||||
(getLongFromObjectOrReply(c, c->argv[j+2], &limit_count, NULL) != REDIS_OK)) return;
|
||||
j+=2;
|
||||
} else if (!strcasecmp(c->argv[j]->ptr,"store") && leftargs >= 1) {
|
||||
storekey = c->argv[j+1];
|
||||
|
Reference in New Issue
Block a user