eggdrop icon indicating copy to clipboard operation
eggdrop copied to clipboard

Fix some year 2038 problems

Open michaelortmann opened this issue 3 years ago • 0 comments

Found by: michaelortmann Patch by: michaelortmann and thommey Fixes:

One-line summary: Fix some year 2038 problems

Additional description (if needed): Fix time_t handling (buffer size, type and format specifier) POSIX requires time_t to be an integer type, but does not mandate that it be signed or unsigned. time_t to string conversion used buffersize 11, 10 chars + NULL-terminator, would overflow with unixtime >9999999999 (year 2286) Also fixes the following compiler warning under OpenBSD 7.1 clang 13.0.0:

cc -g -O2 -pipe -Wall -I.. -I..  -DHAVE_CONFIG_H -I/usr/local/include/tcl8.6 -g3 -DDEBUG -DDEBUG_ASSERT -DDEBUG_MEM -DDEBUG_DNS  -c botcmd.c
botcmd.c:841:19: warning: format specifies type 'unsigned long' but the argument has type 'long long' [-Wformat]
                  now - t, j, (j != 1) ? "s" : "");
                  ^~~~~~~
1 warning generated.

Test cases demonstrating functionality (if applicable):

michaelortmann avatar Sep 12 '22 08:09 michaelortmann