A recent patch replaced two sprintf() calls with snprintf(), but didn't
use the right length for the remaining space in the buffer.
Differential Revision: https://reviews.llvm.org/D155224
++expo;
}
if (q >= buffer && q < buffer + sizeof buffer) {
- std::snprintf(q + result.length, sizeof buffer, "e%d", expo);
+ std::snprintf(q + result.length,
+ buffer + sizeof buffer - (q + result.length), "e%d", expo);
}
const char *p{q};
auto rflags{ConvertDecimalToFloat(&p, &y, RoundNearest)};
if (*q == '-' || *q == '+') {
++expo;
}
- std::snprintf(q + result.length, sizeof buffer, "e%d", expo);
+ std::snprintf(q + result.length,
+ buffer + sizeof buffer - (q + result.length), "e%d", expo);
}
const char *p{q};
auto rflags{ConvertDecimalToFloat(&p, &y, RoundNearest)};