From: Campo Weijerman Date: Mon, 18 Jul 2005 17:34:55 +0000 (+0200) Subject: Re: AIX 5.2 localtime bug attack X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3574fba9d64258926d8208a0796e6f0aef583eeb;p=p5sagit%2Fp5-mst-13.2.git Re: AIX 5.2 localtime bug attack Message-ID: <20050718153455.GA29381@python> mday++ is also wday++ and yday++ p4raw-id: //depot/perl@25173 --- diff --git a/pp_sys.c b/pp_sys.c index 63eebef..545765c 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -4572,14 +4572,16 @@ static struct tm *S_my_localtime (pTHX_ Time_t *tp) * Given that legal timezones are typically between GMT-12 and GMT+12 * we turn back the clock 23 hours before calling the localtime * function, and add those to the return value. This will never cause - * day wrapping problems, since the edge case is Jan *19* + * day wrapping problems, since the edge case is Tue Jan *19* */ T = *tp - 82800; /* 23 hour. allows up to GMT-23 */ P = localtime (&T); P->tm_hour += 23; if (P->tm_hour >= 24) { P->tm_hour -= 24; - P->tm_mday++; + P->tm_mday++; /* 18 -> 19 */ + P->tm_wday++; /* Mon -> Tue */ + P->tm_yday++; /* 18 -> 19 */ } return (P); } /* S_my_localtime */