Skip to content

Commit

Permalink
Fix code scanning alert no. 213: Use of potentially dangerous function (
Browse files Browse the repository at this point in the history
#292)

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
  • Loading branch information
nibanks and github-advanced-security[bot] authored Dec 30, 2024
1 parent 845f13b commit 756317f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/quicreach.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,13 @@ void DumpResultsToFile() {
}
char UtcDateTime[256];
time_t Time = time(nullptr);
struct tm* Tm = gmtime(&Time);
strftime(UtcDateTime, sizeof(UtcDateTime), "%Y.%m.%d-%H:%M:%S", Tm);
struct tm Tm;
#ifdef _WIN32
gmtime_s(&Tm, &Time);
#else
gmtime_r(&Time, &Tm);
#endif
strftime(UtcDateTime, sizeof(UtcDateTime), "%Y.%m.%d-%H:%M:%S", &Tm);
fprintf(File, "%s,%u,%u,%u,%u,%u,%u,%u,%u\n", UtcDateTime,
Results.TotalCount.load(), Results.ReachableCount.load(), Results.TooMuchCount.load(), Results.MultiRttCount.load(),
Results.RetryCount.load(), Results.IPv6Count.load(), Results.Quicv2Count.load(), Results.WayTooMuchCount.load());
Expand Down

0 comments on commit 756317f

Please sign in to comment.