mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 00:28:26 -05:00
use getPositiveLongFromObjectOrReply for positive check of args (#8750)
just a cleanup
This commit is contained in:
parent
4c14e8668c
commit
d96f47cf06
14
src/t_list.c
14
src/t_list.c
@ -592,20 +592,14 @@ void lposCommand(client *c) {
|
||||
}
|
||||
} else if (!strcasecmp(opt,"COUNT") && moreargs) {
|
||||
j++;
|
||||
if (getLongFromObjectOrReply(c, c->argv[j], &count, NULL) != C_OK)
|
||||
if (getPositiveLongFromObjectOrReply(c, c->argv[j], &count,
|
||||
"COUNT can't be negative") != C_OK)
|
||||
return;
|
||||
if (count < 0) {
|
||||
addReplyError(c,"COUNT can't be negative");
|
||||
return;
|
||||
}
|
||||
} else if (!strcasecmp(opt,"MAXLEN") && moreargs) {
|
||||
j++;
|
||||
if (getLongFromObjectOrReply(c, c->argv[j], &maxlen, NULL) != C_OK)
|
||||
if (getPositiveLongFromObjectOrReply(c, c->argv[j], &maxlen,
|
||||
"MAXLEN can't be negative") != C_OK)
|
||||
return;
|
||||
if (maxlen < 0) {
|
||||
addReplyError(c,"MAXLEN can't be negative");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
addReplyErrorObject(c,shared.syntaxerr);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user