svn commit: samba r19602 - in branches: SAMBA_3_0_23/source/lib SAMBA_3_0_24/source/lib

tridge at tridge at
Tue Nov 7 09:48:48 GMT 2006


 > I assume this has bugs, as tm->tm_mon == 12 is valid and the array which
 > uses it as index has only 12 members...
 > tridge: had you gave me a reason, why you used > 12 in the samba4 commit?

I use > 12 because a value of 12 doesn't cause a segv. The loop is:

	for (i = 0; i < tm->tm_mon; ++i)
		res += ndays[is_leap(tm->tm_year)][i];

so i goes to max 11 with tm_mon == 12. That is fine with the array

Really what this means is the '31' for December is not actually needed
in the code, which makes sense, as you never need to know how many
days in December in this calculation (as its implied in the 365

anyway, either > 11 or > 12 is fine, both will stop the potential

Cheers, Tridge

More information about the samba-technical mailing list