Unverified Commit 79ffc352 authored by Oran Agra's avatar Oran Agra Committed by GitHub
Browse files

fix broken protocol regression from #10612 (#10639)

A change in #10612 introduced a regression.
when replying with garbage bytes to the caller, we must make sure it
doesn't include any newlines.

in the past it called rejectCommandFormat which did that trick.
but now it calls rejectCommandSds, which doesn't, so we need to make sure
to sanitize the sds.
parent 119ec91a
...@@ -3520,6 +3520,9 @@ int commandCheckExistence(client *c, sds *err) { ...@@ -3520,6 +3520,9 @@ int commandCheckExistence(client *c, sds *err) {
(char*)c->argv[0]->ptr, args); (char*)c->argv[0]->ptr, args);
sdsfree(args); sdsfree(args);
} }
/* Make sure there are no newlines in the string, otherwise invalid protocol
* is emitted (The args come from the user, they may contain any character). */
sdsmapchars(*err, "\r\n", " ", 2);
return 0; return 0;
} }
......
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