提交 231d758e 编写于 作者: A antirez

in rdbLoadDoubleValue now the buffer is nul terminated correctly. Thanks valgrind.

上级 83c6a618
...@@ -2823,6 +2823,7 @@ static int rdbLoadDoubleValue(FILE *fp, double *val) { ...@@ -2823,6 +2823,7 @@ static int rdbLoadDoubleValue(FILE *fp, double *val) {
case 253: *val = R_Nan; return 0; case 253: *val = R_Nan; return 0;
default: default:
if (fread(buf,len,1,fp) == 0) return -1; if (fread(buf,len,1,fp) == 0) return -1;
buf[len] = '\0';
sscanf(buf, "%lg", val); sscanf(buf, "%lg", val);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册