XADD MAXLEN should return an error for values < 0.

This commit is contained in:
antirez 2018-06-17 10:44:01 +02:00
parent 2e0ab4a807
commit 79a1c19ac2

View File

@ -1105,6 +1105,11 @@ void xaddCommand(client *c) {
}
if (getLongLongFromObjectOrReply(c,c->argv[i+1],&maxlen,NULL)
!= C_OK) return;
if (maxlen < 0) {
addReplyError(c,"The MAXLEN argument must be equal or greater than zero. A value of zero means that no trimming should be performed.");
return;
}
i++;
maxlen_arg_idx = i;
} else {