mirror of
https://github.com/fluencelabs/redis
synced 2025-04-10 03:06:05 +00:00
Merge pull request #1451 from yossigo/unbalanced-quotes-fix
Return proper error on requests with an unbalanced number of quotes.
This commit is contained in:
commit
0a89d9a0b1
@ -891,6 +891,11 @@ int processInlineBuffer(redisClient *c) {
|
|||||||
aux = sdsnewlen(c->querybuf,querylen);
|
aux = sdsnewlen(c->querybuf,querylen);
|
||||||
argv = sdssplitargs(aux,&argc);
|
argv = sdssplitargs(aux,&argc);
|
||||||
sdsfree(aux);
|
sdsfree(aux);
|
||||||
|
if (argv == NULL) {
|
||||||
|
addReplyError(c,"Protocol error: unbalanced quotes in request");
|
||||||
|
setProtocolError(c,0);
|
||||||
|
return REDIS_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
/* Newline from slaves can be used to refresh the last ACK time.
|
/* Newline from slaves can be used to refresh the last ACK time.
|
||||||
* This is useful for a slave to ping back while loading a big
|
* This is useful for a slave to ping back while loading a big
|
||||||
|
@ -60,6 +60,14 @@ start_server {tags {"protocol"}} {
|
|||||||
assert_error "*wrong*arguments*ping*" {r ping x y z}
|
assert_error "*wrong*arguments*ping*" {r ping x y z}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test "Unbalanced number of quotes" {
|
||||||
|
reconnect
|
||||||
|
r write "set \"\"\"test-key\"\"\" test-value\r\n"
|
||||||
|
r write "ping\r\n"
|
||||||
|
r flush
|
||||||
|
assert_error "*unbalanced*" {r read}
|
||||||
|
}
|
||||||
|
|
||||||
set c 0
|
set c 0
|
||||||
foreach seq [list "\x00" "*\x00" "$\x00"] {
|
foreach seq [list "\x00" "*\x00" "$\x00"] {
|
||||||
incr c
|
incr c
|
||||||
|
Loading…
x
Reference in New Issue
Block a user