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
53f1d817
Commit
53f1d817
authored
Dec 16, 2010
by
Pieter Noordhuis
Browse files
Fix NULL-termination of variable data in redis-benchmark
parent
021321e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/redis-benchmark.c
View file @
53f1d817
...
@@ -195,6 +195,11 @@ static void readHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
...
@@ -195,6 +195,11 @@ static void readHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
exit
(
1
);
exit
(
1
);
}
}
if
(
reply
!=
NULL
)
{
if
(
reply
!=
NULL
)
{
if
(
reply
==
(
void
*
)
REDIS_REPLY_ERROR
)
{
fprintf
(
stderr
,
"Unexpected error reply, exiting...
\n
"
);
exit
(
1
);
}
if
(
config
.
donerequests
<
config
.
requests
)
if
(
config
.
donerequests
<
config
.
requests
)
config
.
latency
[
config
.
donerequests
++
]
=
c
->
latency
;
config
.
latency
[
config
.
donerequests
++
]
=
c
->
latency
;
clientDone
(
c
);
clientDone
(
c
);
...
@@ -454,8 +459,9 @@ int main(int argc, char **argv) {
...
@@ -454,8 +459,9 @@ int main(int argc, char **argv) {
c
->
obuf
=
sdscatprintf
(
c
->
obuf
,
"*%d
\r\n
$4
\r\n
MSET
\r\n
"
,
11
);
c
->
obuf
=
sdscatprintf
(
c
->
obuf
,
"*%d
\r\n
$4
\r\n
MSET
\r\n
"
,
11
);
{
{
int
i
;
int
i
;
char
*
data
=
zmalloc
(
config
.
datasize
+
2
);
char
*
data
=
zmalloc
(
config
.
datasize
+
1
);
memset
(
data
,
'x'
,
config
.
datasize
);
memset
(
data
,
'x'
,
config
.
datasize
);
data
[
config
.
datasize
]
=
'\0'
;
for
(
i
=
0
;
i
<
10
;
i
++
)
{
for
(
i
=
0
;
i
<
10
;
i
++
)
{
c
->
obuf
=
sdscatprintf
(
c
->
obuf
,
"$%d
\r\n
%s
\r\n
"
,
config
.
datasize
,
data
);
c
->
obuf
=
sdscatprintf
(
c
->
obuf
,
"$%d
\r\n
%s
\r\n
"
,
config
.
datasize
,
data
);
}
}
...
...
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