mirror of
https://github.com/cesanta/mongoose.git
synced 2025-08-06 13:37:34 +08:00
Fix issue #1733
This commit is contained in:
parent
fc2d6eb6bb
commit
dd4227f444
@ -559,7 +559,9 @@ static size_t mg_dtoa(char *dst, size_t dstlen, double d, int width) {
|
||||
}
|
||||
while (n > 0 && buf[s + n - 1] == '0') n--; // Trim trailing zeros
|
||||
if (n > 0 && buf[s + n - 1] == '.') n--; // Trim trailing dot
|
||||
buf[s + n] = '\0';
|
||||
n += s;
|
||||
if (n >= (int) sizeof(buf)) n = (int) sizeof(buf) - 1;
|
||||
buf[n] = '\0';
|
||||
return mg_snprintf(dst, dstlen, "%s", buf);
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,9 @@ static size_t mg_dtoa(char *dst, size_t dstlen, double d, int width) {
|
||||
}
|
||||
while (n > 0 && buf[s + n - 1] == '0') n--; // Trim trailing zeros
|
||||
if (n > 0 && buf[s + n - 1] == '.') n--; // Trim trailing dot
|
||||
buf[s + n] = '\0';
|
||||
n += s;
|
||||
if (n >= (int) sizeof(buf)) n = (int) sizeof(buf) - 1;
|
||||
buf[n] = '\0';
|
||||
return mg_snprintf(dst, dstlen, "%s", buf);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user