From: H. Peter Anvin Date: Sun, 14 Feb 2010 22:11:15 +0000 (-0800) Subject: sysdump: guard against a nonsensical month number X-Git-Tag: syslinux-4.00-pre21~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=97a0ccf075ff62f1cf8deafe701e182a60515a8e;p=platform%2Fupstream%2Fsyslinux.git 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 --- 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;