diff mbox

[09/13] mktime: fix off-by-one error calling days_in_month

Message ID 20170823072123.18769-10-stewart@linux.vnet.ibm.com
State Accepted
Headers show

Commit Message

Stewart Smith Aug. 23, 2017, 7:21 a.m. UTC
From auditing all the mktime() users, there seems to be only a *very*
small window around new years day where we could possibly return
incorrect data to the OS, and even then, there would have to be FSP
reset/reload on FSP machines. I don't *think* there's an opportunity
on other machines.

Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
---
 libc/time.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/libc/time.c b/libc/time.c
index 6a5108691af1..71bbdff647f3 100644
--- a/libc/time.c
+++ b/libc/time.c
@@ -121,7 +121,7 @@  time_t mktime(struct tm *tm)
 	for (d = days_in_month(month, year); mday > d;
 			d = days_in_month(month, year)) {
 		month++;
-		if (month > 12) {
+		if (month > 11) {
 			month = 0;
 			year++;
 		}