Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
6e258c76
"vscode:/vscode.git/clone" did not exist on "d0f710ea0956433222a42acf29bdde911004b303"
Commit
6e258c76
authored
Apr 27, 2011
by
Pieter Noordhuis
Browse files
Check seplen and len before malloc'ing "tokens"
parent
355d8cb0
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/sds.c
View file @
6e258c76
...
...
@@ -296,12 +296,17 @@ int sdscmp(sds s1, sds s2) {
*/
sds
*
sdssplitlen
(
char
*
s
,
int
len
,
char
*
sep
,
int
seplen
,
int
*
count
)
{
int
elements
=
0
,
slots
=
5
,
start
=
0
,
j
;
sds
*
tokens
;
sds
*
tokens
=
zmalloc
(
sizeof
(
sds
)
*
slots
);
if
(
seplen
<
1
||
len
<
0
)
return
NULL
;
tokens
=
zmalloc
(
sizeof
(
sds
)
*
slots
);
#ifdef SDS_ABORT_ON_OOM
if
(
tokens
==
NULL
)
sdsOomAbort
();
#else
if
(
tokens
==
NULL
)
return
NULL
;
#endif
if
(
seplen
<
1
||
len
<
0
||
tokens
==
NULL
)
return
NULL
;
if
(
len
==
0
)
{
*
count
=
0
;
return
tokens
;
...
...
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