diff options
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/replace/timegm.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source3/lib/replace/timegm.c b/source3/lib/replace/timegm.c index 8db9bb4e09..395c684e11 100644 --- a/source3/lib/replace/timegm.c +++ b/source3/lib/replace/timegm.c @@ -51,6 +51,16 @@ time_t rep_timegm(struct tm *tm) {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}}; time_t res = 0; unsigned i; + + if (tm->tm_mon > 12 || + tm->tm_mon < 0 || + tm->tm_mday > 31 || + tm->tm_min > 60 || + tm->tm_sec > 60 || + tm->tm_hour > 24) { + /* invalid tm structure */ + return 0; + } for (i = 70; i < tm->tm_year; ++i) res += is_leap(i) ? 366 : 365; |