[ldns-users] Bug in ldns_year_and_yday_from_days_since_epoch (only on 32 bits)
Miek Gieben
miek at miek.nl
Fri Dec 23 13:00:24 UTC 2011
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.nlnetlabs.nl/pipermail/ldns-users/attachments/20111223/1e22d6ab/attachment.bin>
More information about the ldns-users
mailing list