projects
/
profile
/
ivi
/
syslinux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0b493ec
)
sysdump: guard against a nonsensical month number
author
H. Peter Anvin
<hpa@zytor.com>
Sun, 14 Feb 2010 22:11:15 +0000
(14:11 -0800)
committer
H. Peter Anvin
<hpa@zytor.com>
Sun, 14 Feb 2010 22:11:15 +0000
(14:11 -0800)
If the month is off the table, don't even try to read it...
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
com32/sysdump/ctime.c
patch
|
blob
|
history
diff --git
a/com32/sysdump/ctime.c
b/com32/sysdump/ctime.c
index
5af8566
..
56c8efb
100644
(file)
--- 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;