Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
b19c33d4
Commit
b19c33d4
authored
Oct 15, 2010
by
Pieter Noordhuis
Browse files
Prevent clients from making too large multibulk requests
parent
ea5b7092
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/networking.c
View file @
b19c33d4
...
...
@@ -724,6 +724,10 @@ int processMultibulkBuffer(redisClient *c) {
if
(
c
->
multibulklen
<=
0
)
{
c
->
querybuf
=
sdsrange
(
c
->
querybuf
,
pos
,
-
1
);
return
REDIS_OK
;
}
else
if
(
c
->
multibulklen
>
1024
*
1024
)
{
addReplyError
(
c
,
"Protocol error: invalid multibulk length"
);
setProtocolError
(
c
,
pos
);
return
REDIS_ERR
;
}
/* Setup argv array on client structure */
...
...
tests/unit/protocol.tcl
View file @
b19c33d4
...
...
@@ -13,6 +13,13 @@ start_server {tags {"protocol"}} {
assert_equal PONG
[
r ping
]
}
test
"Out of range multibulk length"
{
reconnect
r write
"*20000000
\r\n
"
r flush
assert_error
"*invalid multibulk length*"
{
r read
}
}
test
"Wrong multibulk payload header"
{
reconnect
r write
"*3
\r\n\$
3
\r\n
SET
\r\n\$
1
\r\n
x
\r\n
fooz
\r\n
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment