Commit f25ea40a by Brian Wolfe

timers: use snprintf instead of sprintf

parent f6ac240c
......@@ -213,9 +213,8 @@ std::string LocalDateTimeString() {
tz_offset_sign = '-';
}
// Apply % 100 to hour to guarantee range [0, 99].
tz_len = ::sprintf(tz_offset, "%c%02li:%02li", tz_offset_sign,
(offset_minutes / 100) % 100, offset_minutes % 100);
tz_len = ::snprintf(tz_offset, sizeof(tz_offset), "%c%02li:%02li",
tz_offset_sign, (offset_minutes / 100), offset_minutes % 100);
CHECK(tz_len == 6);
((void)tz_len); // Prevent unused variable warning in optimized build.
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment