[ldns-users] Bug in ldns_year_and_yday_from_days_since_epoch (only on 32 bits)
Willem Toorop
Willem at NLnetLabs.nl
Fri Dec 23 21:21:19 UTC 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Ouch! Very nasty. A correct fix is attached.
- -- willem
Op 23-12-11 14:00, Miek Gieben schreef:
> Hello,
>
> There seems to be a off-by-one bug in the function
> ldns_year_and_yday_from_days_since_epoch() in util.c
>
> See this thread on the opendssec list:
> http://lists.opendnssec.org/pipermail/opendnssec-user/2011-December/001501.html
>
> I think the patch below fixes things. Can some of the ldns
> maintainers take a second look?
>
> --- util.c.patch 2011-12-23 13:44:21.000000000 +0100 +++
> util.c 2011-12-23 13:44:38.000000000 +0100 @@ -255,7 +255,7
> @@ int year = 1970; int new_year;
>
> - while (days < 0 || days >= (int64_t) (is_leap_year(year) ?
> 366 : 365)) { + while (days < 0 || days > (int64_t)
> (is_leap_year(year) ? 366 : 365)) { new_year = year + (int)
> LDNS_DIV(days, 366); if (year == new_year) { year += days < 0 ? -1
> : 1;
>
> grtz Miek
>
>
>
> _______________________________________________ ldns-users mailing
> list ldns-users at open.nlnetlabs.nl
> http://open.nlnetlabs.nl/mailman/listinfo/ldns-users
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJO9PDJAAoJEOX4+CEvd6SYnDMP/ipLfuVLJ4JuiAgcfpe8mAAN
UIbiLJSl5B74tayr2CBbhMocQ6UpjRqwMdyAZ2WJEUvHakOPLT92tqHlKlCI2Kty
1ahCaLQzOlSDxhSTigdN36U7lWOq6V1bEEujcbjmhtgWNka9Nau/LilL98PML1th
0CA3jQhNHeJ5YTKZDUr+4T36p8oIebNBiUtZ2OhB8MXGrZfbEWfRIQVr56M9EkDY
8AeUC30eqVhFKii//Cof2HF/uF04HOBTvaPAR0Pbs9aUe7SKAo+1olJ9orVhSUtl
f6NiEGbWUdauuhMd4TJyFaegYfqAe2inv4mhLpE7oFhK7HyXZLu/CGY9LyZ/21CV
s4ZgRde72Zaa0ZIAGtliUezPi5EbZY4h/QLAFy3W2hahywOHyGT40Paj9wpSKZId
OgPecCD/m2ErffC4Va/ZU40XplZVU9Xdkcc81Aw18KHb0JdFDtRGumKD2lnc+Gtu
KatsbwWFzDf9snS0Ou/qd7j0KYZeT93k5T8mjDuTrc24RIdypq55kWYAJoFR/ImA
A19poNCyJwe1I7wTiZLCf9lNQIpvWzmWICUElqrcZb87VI1e5Nro0CIb1rQ2J6Om
4ZwGOtatdnQsJzrpjRtX560UHIPK0wHbc5htjgw97fPtLnIsZ0PS4WN6XeTRktSE
5sa16nNz/E4j5DcFVt8A
=tXzf
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: util.c.patch
Type: text/x-patch
Size: 450 bytes
Desc: not available
URL: <http://lists.nlnetlabs.nl/pipermail/ldns-users/attachments/20111223/ca532372/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: util.c.patch.sig
Type: application/octet-stream
Size: 543 bytes
Desc: not available
URL: <http://lists.nlnetlabs.nl/pipermail/ldns-users/attachments/20111223/ca532372/attachment.obj>
More information about the ldns-users
mailing list