Bug 751412 - Add missing buffer null-termination in CreateDecimalRepresentation, r=njn

This commit is contained in:
Christian Holler 2012-05-04 10:40:54 -04:00
parent 3b21fd29c5
commit 3442e45421

View File

@ -98,7 +98,8 @@ void DoubleToStringConverter::CreateExponentialRepresentation(
}
ASSERT(exponent < 1e4);
const int kMaxExponentLength = 5;
char buffer[kMaxExponentLength];
char buffer[kMaxExponentLength + 1];
buffer[kMaxExponentLength] = '\0';
int first_char_pos = kMaxExponentLength;
while (exponent > 0) {
buffer[--first_char_pos] = '0' + (exponent % 10);