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
78025c4a
Unverified
Commit
78025c4a
authored
Nov 02, 2021
by
yiyuaner
Committed by
GitHub
Nov 02, 2021
Browse files
Add checks for overflow in redis-check-aof and loadAppendOnlyFile (#9669)
Co-authored-by:
guoyiyuan
<
guoyiyuan@sbrella.com
>
parent
87321deb
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/aof.c
View file @
78025c4a
...
@@ -783,6 +783,7 @@ int loadAppendOnlyFile(char *filename) {
...
@@ -783,6 +783,7 @@ int loadAppendOnlyFile(char *filename) {
if
(
buf
[
1
]
==
'\0'
)
goto
readerr
;
if
(
buf
[
1
]
==
'\0'
)
goto
readerr
;
argc
=
atoi
(
buf
+
1
);
argc
=
atoi
(
buf
+
1
);
if
(
argc
<
1
)
goto
fmterr
;
if
(
argc
<
1
)
goto
fmterr
;
if
((
size_t
)
argc
>
SIZE_MAX
/
sizeof
(
robj
*
))
goto
fmterr
;
/* Load the next command in the AOF as our fake client
/* Load the next command in the AOF as our fake client
* argv. */
* argv. */
...
...
src/redis-check-aof.c
View file @
78025c4a
...
@@ -124,6 +124,11 @@ int readString(FILE *fp, char** target) {
...
@@ -124,6 +124,11 @@ int readString(FILE *fp, char** target) {
return
0
;
return
0
;
}
}
if
(
len
<
0
||
len
>
LONG_MAX
-
2
)
{
ERROR
(
"Expected to read string of %ld bytes, which is not in the suitable range"
,
len
);
return
0
;
}
/* Increase length to also consume \r\n */
/* Increase length to also consume \r\n */
len
+=
2
;
len
+=
2
;
*
target
=
(
char
*
)
zmalloc
(
len
);
*
target
=
(
char
*
)
zmalloc
(
len
);
...
...
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