summaryrefslogtreecommitdiffstats
path: root/login-utils/last.c
diff options
context:
space:
mode:
authorJ William Piggott2017-09-26 02:56:06 +0200
committerJ William Piggott2017-11-10 21:49:45 +0100
commit8c5a21f2187f78e9aab02f5f11dbbd226a4d795d (patch)
tree9d6ba8c0ff02fd91bcc64dab18ec4138f76da7ac /login-utils/last.c
parenthwclock: add iso-8601 overflow check (diff)
downloadkernel-qcow2-util-linux-8c5a21f2187f78e9aab02f5f11dbbd226a4d795d.tar.gz
kernel-qcow2-util-linux-8c5a21f2187f78e9aab02f5f11dbbd226a4d795d.tar.xz
kernel-qcow2-util-linux-8c5a21f2187f78e9aab02f5f11dbbd226a4d795d.zip
lib/timeutils: ISO_8601_BUFSIZ too small
Although iso-8601 specifies years as 4 digits, it allows them to be wider. The current POSIX year width is limited by 'int tm_year' at 10 digits plus a negative sign. That, and the possibility of nanosecond time makes the widest POSIX iso-8601 time 41 characters. Plus the \0 string terminator yields a buffer size of 42. Before truncated output: /sbin/hwclock --utc --noadjfile --predict --date '-2147483765 years' -2147481748-09-25 20:29:45.0000 Patched: ./hwclock --utc --noadjfile --predict --date '-2147483765 years' -2147481748-09-25 20:17:21.000000-0456 ./hwclock --utc --noadjfile --predict --date '-2147483766 years' hwclock: invalid date '-2147483766 years' Comparable to coreutils 'date' command: date -Ins --date '-2147483765 years' -2147481748-09-25T19:49:31,578899297-0456 date -Ins --date '-2147483766 years' date: invalid date '-2147483766 years' The 'date' output illustrates the full 41 character POSIX iso-8601 Signed-off-by: J William Piggott <elseifthen@gmx.com>
Diffstat (limited to 'login-utils/last.c')
0 files changed, 0 insertions, 0 deletions