Commit c6646cb1 authored by Alex Smith's avatar Alex Smith Committed by michael-grunder
Browse files

read: Ensure no invalid '\r' or '\n' in simple status/error strings

parent e4306115
...@@ -339,6 +339,13 @@ static int processLineItem(redisReader *r) { ...@@ -339,6 +339,13 @@ static int processLineItem(redisReader *r) {
obj = (void*)REDIS_REPLY_BOOL; obj = (void*)REDIS_REPLY_BOOL;
} else { } else {
/* Type will be error or status. */ /* Type will be error or status. */
for (int i = 0; i < len; i++) {
if (p[i] == '\r' || p[i] == '\n') {
__redisReaderSetError(r,REDIS_ERR_PROTOCOL,
"Bad simple string value");
return REDIS_ERR;
}
}
if (r->fn && r->fn->createString) if (r->fn && r->fn->createString)
obj = r->fn->createString(cur,p,len); obj = r->fn->createString(cur,p,len);
else else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment