Skip to content

Commit e8712e4

Browse files
authored
Merge pull request #232 from google/reland-snprintf
Reland snprintf fix
2 parents dfc3b24 + e3da80f commit e8712e4

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

cpp/src/validating_util.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ bool UnwrapHeader(const char* header_prefix,
8484
void ValidatingUtil::Wrap(time_t timestamp, std::string* data) {
8585
assert(data != nullptr);
8686
char timestamp_string[2 + 3 * sizeof timestamp];
87-
int size =
88-
std::sprintf(timestamp_string, "%ld", static_cast<long>(timestamp));
87+
int size = std::snprintf(timestamp_string, sizeof(timestamp_string), "%ld",
88+
static_cast<long>(timestamp));
8989
assert(size > 0);
9090
assert(size < sizeof timestamp_string);
9191
(void)size;

0 commit comments

Comments
 (0)