Skip to content

Commit dd82c2c

Browse files
committed
don't use sprintf
1 parent 865f8f0 commit dd82c2c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/s2/util/math/exactfloat/exactfloat.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ std::string ExactFloat::ToStringWithMaxDigits(int max_digits) const {
409409
str.append(digits.begin() + 1, digits.end());
410410
}
411411
char exp_buf[20];
412-
sprintf(exp_buf, "e%+02d", exp10 - 1);
412+
snprintf(exp_buf, sizeof(exp_buf), "e%+02d", exp10 - 1);
413413
str += exp_buf;
414414
} else {
415415
// Use fixed format. We split this into two cases depending on whether
@@ -512,7 +512,7 @@ int ExactFloat::GetDecimalDigits(int max_digits, std::string* digits) const {
512512

513513
std::string ExactFloat::ToUniqueString() const {
514514
char prec_buf[20];
515-
sprintf(prec_buf, "<%d>", prec());
515+
snprintf(prec_buf, sizeof(prec_buf), "<%d>", prec());
516516
return ToString() + prec_buf;
517517
}
518518

0 commit comments

Comments
 (0)