diff options
author | Mike Frysinger <vapier@gentoo.org> | 2006-03-01 01:03:41 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2006-03-01 01:03:41 +0000 |
commit | 6fdc49d6b5478bdb8326e3c15ac88d863ec416cc (patch) | |
tree | 51dd30ec24c41856463fbf3ff414a86c6a2a69a7 | |
parent | e6e11ae65129ca3b6db9418476ff806b0aacdaa7 (diff) |
return NULL if year is too big
-rw-r--r-- | libc/misc/time/time.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c index fb79883c9..9cc59d008 100644 --- a/libc/misc/time/time.c +++ b/libc/misc/time/time.c @@ -365,10 +365,22 @@ char *asctime_r(register const struct tm *__restrict ptm, tmp /= 10; } while (*--buffer == '?'); } +/* Not sure if we should even bother ... + } else { + __set_errno(EOVERFLOW); + return NULL; + } +*/ #else /* SAFE_ASCTIME_R */ buffer += 23; tmp = ptm->tm_year + 1900; assert( ((unsigned int) tmp) < 10000 ); +/* Not sure if we should even bother ... + if ( ((unsigned int) tmp) >= 10000 ) { + __set_errno(EOVERFLOW); + return NULL; + } +*/ do { *buffer = '0' + (tmp % 10); tmp /= 10; |