svn commit: samba r19601 - in
branches/SAMBA_3_0/source/lib/replace: .
jra at samba.org
jra at samba.org
Tue Nov 7 02:33:10 GMT 2006
Author: jra
Date: 2006-11-07 02:33:10 +0000 (Tue, 07 Nov 2006)
New Revision: 19601
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19601
Log:
Fix protection from invalid struct tm values.
Backport from Samba4.
Jeremy.
Modified:
branches/SAMBA_3_0/source/lib/replace/timegm.c
Changeset:
Modified: branches/SAMBA_3_0/source/lib/replace/timegm.c
===================================================================
--- branches/SAMBA_3_0/source/lib/replace/timegm.c 2006-11-07 01:25:17 UTC (rev 19600)
+++ branches/SAMBA_3_0/source/lib/replace/timegm.c 2006-11-07 02:33:10 UTC (rev 19601)
@@ -51,6 +51,16 @@
{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;
More information about the samba-cvs
mailing list