Handle null terminator at the end of the buffer

This commit is contained in:
Victor Zverovich committed 2019-11-24 07:15:25 -08:00
1 parent 63a9f3fcd4
commit 43271ba8e8
2 files changed
+24 -18

No files matched your search

+2 -1
View File
@@ -1159,7 +1159,8 @@ int snprintf_float(T value, int precision, float_spec spec, buffer<char>& buf) {
continue;
}
unsigned size = to_unsigned(result);
if (size > capacity) {
// Size equal to capacity means that the last character was truncated.
if (size >= capacity) {
buf.reserve(size + 1); // Add 1 for the terminating '\0'.
continue;
}