Skip to content

Commit

Permalink
Use snprintf instead of sprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
dillona committed Nov 24, 2022
1 parent d4c8c1a commit e834dc0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* **Bug Fix**
* FIXED: valhalla_run_route was missing config logic.[#3824](https://github.com/valhalla/valhalla/pull/3824)
* FIXED: Handle hexlifying strings with unsigned chars [#3842](https://github.com/valhalla/valhalla/pull/3842)
* FIXED: Valhalla does not build on macOS with clang 14.0.0 [#3846](https://github.com/valhalla/valhalla/issues/3846)
* **Enhancement**
* ADDED: Add time info to sources_to_targets [#3795](https://github.com/valhalla/valhalla/pull/3795)
* ADDED: "available_actions" to the /status response [#3836](https://github.com/valhalla/valhalla/pull/3836)
Expand Down
4 changes: 2 additions & 2 deletions src/midgard/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ std::string TimeStamp() {
(tp - std::chrono::system_clock::from_time_t(tt)) + std::chrono::seconds(gmt.tm_sec);
// format the string
std::string buffer("year/mo/dy hr:mn:sc.xxxxxx");
sprintf(&buffer.front(), "%04d/%02d/%02d %02d:%02d:%09.6f", gmt.tm_year + 1900, gmt.tm_mon + 1,
gmt.tm_mday, gmt.tm_hour, gmt.tm_min, fractional_seconds.count());
snprintf(&buffer.front(), buffer.capacity(), "%04d/%02d/%02d %02d:%02d:%09.6f", gmt.tm_year + 1900,
gmt.tm_mon + 1, gmt.tm_mday, gmt.tm_hour, gmt.tm_min, fractional_seconds.count());
return buffer;
}

Expand Down

0 comments on commit e834dc0

Please sign in to comment.