From 97a0ccf075ff62f1cf8deafe701e182a60515a8e Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 14 Feb 2010 14:11:15 -0800 Subject: [PATCH] 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 --- com32/sysdump/ctime.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/com32/sysdump/ctime.c b/com32/sysdump/ctime.c index 5af8566..56c8efb 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; -- 2.7.4