Merge pull request #5812 from guybe7/fix_string2ld

Increase string2ld's buffer size (and fix HINCRBYFLOAT)
This commit is contained in:
Salvatore Sanfilippo 2019-03-14 11:35:01 +01:00 committed by GitHub
commit 190b63f993
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -615,6 +615,10 @@ void hincrbyfloatCommand(client *c) {
}
value += incr;
if (isnan(value) || isinf(value)) {
addReplyError(c,"increment would produce NaN or Infinity");
return;
}
char buf[MAX_LONG_DOUBLE_CHARS];
int len = ld2string(buf,sizeof(buf),value,1);

View File

@ -447,7 +447,7 @@ int string2l(const char *s, size_t slen, long *lval) {
* a double: no spaces or other characters before or after the string
* representing the number are accepted. */
int string2ld(const char *s, size_t slen, long double *dp) {
char buf[256];
char buf[MAX_LONG_DOUBLE_CHARS];
long double value;
char *eptr;