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
b8134dbf
Commit
b8134dbf
authored
Dec 06, 2018
by
antirez
Browse files
RESP3: hiredis: fix double implementation.
parent
a2b2d88f
Changes
1
Show whitespace changes
Inline
Side-by-side
deps/hiredis/read.c
View file @
b8134dbf
...
...
@@ -283,14 +283,14 @@ static int processLineItem(redisReader *r) {
char
buf
[
326
],
*
eptr
;
double
d
;
if
((
size_t
)
len
-
1
>=
sizeof
(
buf
))
{
if
((
size_t
)
len
>=
sizeof
(
buf
))
{
__redisReaderSetError
(
r
,
REDIS_ERR_PROTOCOL
,
"Double value is too large"
);
return
REDIS_ERR
;
}
memcpy
(
buf
,
p
+
1
,
len
-
1
);
buf
[
len
-
1
]
=
'\0'
;
memcpy
(
buf
,
p
,
len
);
buf
[
len
]
=
'\0'
;
if
(
strcasecmp
(
buf
,
",inf"
)
==
0
)
{
d
=
1
.
0
/
0
.
0
;
/* Positive infinite. */
...
...
@@ -298,7 +298,7 @@ static int processLineItem(redisReader *r) {
d
=
-
1
.
0
/
0
.
0
;
/* Nevative infinite. */
}
else
{
d
=
strtod
((
char
*
)
buf
,
&
eptr
);
if
(
eptr
[
0
]
!=
'\0'
||
isnan
(
d
))
{
if
(
buf
[
0
]
==
'\0'
||
eptr
[
0
]
!=
'\0'
||
isnan
(
d
))
{
__redisReaderSetError
(
r
,
REDIS_ERR_PROTOCOL
,
"Bad double value"
);
return
REDIS_ERR
;
...
...
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