Author: gschneider
Date: Wed Aug 5 04:06:25 2009
New Revision: 42402
URL:
http://svn.reactos.org/svn/reactos?rev=42402&view=rev
Log:
asctime/ctime: Check for too low input time, fixes one msvcrt time winetest
Modified:
trunk/reactos/lib/sdk/crt/time/ctime.c
Modified: trunk/reactos/lib/sdk/crt/time/ctime.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/time/ctime.c?r…
==============================================================================
--- trunk/reactos/lib/sdk/crt/time/ctime.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/time/ctime.c [iso-8859-1] Wed Aug 5 04:06:25 2009
@@ -1200,14 +1200,23 @@
"Jul", "Aug", "Sep", "Oct", "Nov",
"Dec"
};
static char result[26];
-
- (void) sprintf(result, "%.3s %.3s%3d %02d:%02d:%02d %d\n",
- wday_name[timeptr->tm_wday],
- mon_name[timeptr->tm_mon],
- timeptr->tm_mday, timeptr->tm_hour,
- timeptr->tm_min, timeptr->tm_sec,
- TM_YEAR_BASE + timeptr->tm_year);
- return result;
+ char* res = result;
+
+ /* Check for invalid input time */
+ if (timeptr->tm_year <= 69)
+ {
+ res = NULL;
+ }
+ else
+ {
+ sprintf(res, "%.3s %.3s%3d %02d:%02d:%02d %d\n",
+ wday_name[timeptr->tm_wday],
+ mon_name[timeptr->tm_mon],
+ timeptr->tm_mday, timeptr->tm_hour,
+ timeptr->tm_min, timeptr->tm_sec,
+ TM_YEAR_BASE + timeptr->tm_year);
+ }
+ return res;
}
/*