Skip to content

Commit

Permalink
Fix possible null pointer dereference. (static analysis report fix)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfdelnero committed Nov 7, 2023
1 parent 5b67aa9 commit cd82b66
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/logs_out.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ void timestamp(char * timestr, int maxsize)
timestr[0] = 0;

local_time = localtime(&ltime);

snprintf(timestr, maxsize, "%.2d:%.2d:%.2d",local_time->tm_hour, local_time->tm_min, local_time->tm_sec );
if(local_time)
snprintf(timestr, maxsize, "%.2d:%.2d:%.2d",local_time->tm_hour, local_time->tm_min, local_time->tm_sec );
else
snprintf(timestr, maxsize, "??:??:??");
}

#ifdef DEBUG
Expand Down

0 comments on commit cd82b66

Please sign in to comment.