summaryrefslogtreecommitdiffstats
path: root/source/lib/timegm.c
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2006-11-13 18:44:26 +0000
committerGerald Carter <jerry@samba.org>2006-11-13 18:44:26 +0000
commitccdeb35f8362feeea37f1def36c602e9a98f08c0 (patch)
treec64d924fe4c5d191a531b1cdf58a3bb337376450 /source/lib/timegm.c
parent76cc7dedb3a5434232a29d3d6e33bf84184e2d76 (diff)
downloadsamba-ccdeb35f8362feeea37f1def36c602e9a98f08c0.tar.gz
samba-ccdeb35f8362feeea37f1def36c602e9a98f08c0.tar.xz
samba-ccdeb35f8362feeea37f1def36c602e9a98f08c0.zip
r19693: merge from SAMBA_3_0_23 tree
Diffstat (limited to 'source/lib/timegm.c')
-rw-r--r--source/lib/timegm.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/lib/timegm.c b/source/lib/timegm.c
index 0e42a863d3f..dcc710b1ece 100644
--- a/source/lib/timegm.c
+++ b/source/lib/timegm.c
@@ -53,6 +53,16 @@ time_t timegm(struct tm *tm)
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;