From 79a1c19ac28ae7feb23630507c2c192e84ba2cb7 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 bcef4355..20daeee9 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 {