From be1fcf16aee6f05b81b07dbe1516c74d482adbf2 Mon Sep 17 00:00:00 2001 From: antirez Date: Sun, 17 Jun 2018 10:44:01 +0200 Subject: [PATCH] XADD MAXLEN should return an error for values < 0. --- src/t_stream.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/t_stream.c b/src/t_stream.c index bcef4355a..20daeee91 100644 --- a/src/t_stream.c +++ b/src/t_stream.c @@ -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 {