Skip to content

Commit

Permalink
zero struct tm before calling strptime()
Browse files Browse the repository at this point in the history
This fixes erratic behaviour with options like --until which can cut off the
display at different places. Typically this might be +/- one hour. This happens
because strptime() only sets fields corresponding to time elements present in
the format string.
  • Loading branch information
andy-bower authored and thkukuk committed Feb 3, 2025
1 parent 72a2861 commit c59256b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/wtmpdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ isipaddr (const char *string, int *addr_type,
static int
parse_time (const char *str, time_t *arg)
{
struct tm res;
struct tm res = { 0 };

if (strcmp (str, "today") == 0)
{
Expand Down

0 comments on commit c59256b

Please sign in to comment.