summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Smith <aes7mv@virginia.edu>2020-10-15 17:54:58 -0400
committermichael-grunder <michael.grunder@gmail.com>2021-02-25 21:25:17 -0800
commitd8899fbc190d49bb09c2576035d4db4ead185846 (patch)
treeec487a0e2d907268a246f2f21e1ff31531ebaaad
parent96e8ea611022e8c360f1883b81f6ec2a386b9ed3 (diff)
read: Add additional RESP3 nil validation
RESP3 nil should consist of "_\r\n" and nothing else.
-rw-r--r--read.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/read.c b/read.c
index 34fce2e..57da853 100644
--- a/read.c
+++ b/read.c
@@ -320,6 +320,12 @@ static int processLineItem(redisReader *r) {
obj = (void*)REDIS_REPLY_DOUBLE;
}
} else if (cur->type == REDIS_REPLY_NIL) {
+ if (len != 0) {
+ __redisReaderSetError(r,REDIS_ERR_PROTOCOL,
+ "Bad nil value");
+ return REDIS_ERR;
+ }
+
if (r->fn && r->fn->createNil)
obj = r->fn->createNil(cur);
else