aboutsummaryrefslogtreecommitdiffstats
path: root/com32/sysdump
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-02-14 14:11:15 -0800
committerH. Peter Anvin <hpa@zytor.com>2010-02-14 14:11:15 -0800
commit97a0ccf075ff62f1cf8deafe701e182a60515a8e (patch)
tree913962f0fdd9ab86b517e2546fed4452bbc1a2e8 /com32/sysdump
parent0b493ec43fc34ce6268e11c20e25fc9438198564 (diff)
downloadsyslinux-97a0ccf075ff62f1cf8deafe701e182a60515a8e.tar.gz
syslinux-97a0ccf075ff62f1cf8deafe701e182a60515a8e.tar.xz
syslinux-97a0ccf075ff62f1cf8deafe701e182a60515a8e.zip
sysdump: guard against a nonsensical month number
If the month is off the table, don't even try to read it... Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'com32/sysdump')
-rw-r--r--com32/sysdump/ctime.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/com32/sysdump/ctime.c b/com32/sysdump/ctime.c
index 5af85666..56c8efb6 100644
--- a/com32/sysdump/ctime.c
+++ b/com32/sysdump/ctime.c
@@ -58,6 +58,13 @@ uint32_t posix_time(void)
mo += 12;
}
+ /*
+ * Just in case: if the month is nonsense, don't read off the end
+ * of the table...
+ */
+ if (mo-3 > 11)
+ return 0;
+
t = y*365 + y/4 - y/100 + y/400 + yday[mo-3] + d - 719469;
t *= 24;
t += h;