aboutsummaryrefslogtreecommitdiff
path: root/scripts/mkdiff_obj
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2025-11-26 12:56:11 +0000
committerRon Yorston <rmy@pobox.com>2025-11-26 12:56:11 +0000
commit3b2f7ff1e0733c8224d0c6a0632abbbb87e8db91 (patch)
tree7c11ad683cb9af3dd4d240d62b7104a0178d0edb /scripts/mkdiff_obj
parent42c3b212d9f9fe964401ed45b1cfd4b67066fb80 (diff)
downloadbusybox-w32-3b2f7ff1e0733c8224d0c6a0632abbbb87e8db91.tar.gz
busybox-w32-3b2f7ff1e0733c8224d0c6a0632abbbb87e8db91.tar.bz2
busybox-w32-3b2f7ff1e0733c8224d0c6a0632abbbb87e8db91.zip
win32: avoid failure when localtime() argument is out of range
The implementation of localtime(3) in the Microsoft Windows runtime only accepts arguments between the Unix epoch (1970) and either 2038 or 3000 for 32-bit or 64-bit systems respectively. For values outside those limits it returns a NULL pointer. Unfortunately, upstream BusyBox hardly ever bothers to check the return value. Thus, when a call to stat(2) returned an all-zero FILETIME for a file, the 'stat' applet failed. An all-zero FILETIME represents a date in 1600, which is clearly before the Unix epoch. Add a wrapper to localtime(3) which detects an out-of-range value and returns a valid 'struct tm' for the Unix epoch. This is easier than adding checks on the return value of every call to localtime(3). Adds 32-48 bytes. (GitHub issue #548)
Diffstat (limited to 'scripts/mkdiff_obj')
0 files changed, 0 insertions, 0 deletions