]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix integer underflow in prefetch ttl creation from cache. This
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 14 Jul 2010 11:13:30 +0000 (11:13 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 14 Jul 2010 11:13:30 +0000 (11:13 +0000)
        fixes a potential negative prefetch ttl.
-This line, and those below, will be ignored--

M    trunk/services/cache/dns.c
M    trunk/doc/Changelog

git-svn-id: file:///svn/unbound/trunk@2198 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
services/cache/dns.c

index 71e56f975b7b93719bc4430f4019f16597e0faa6..b1a1b7557be6d4b9ad81536a0dbde6c9cf5a2beb 100644 (file)
@@ -1,5 +1,7 @@
 14 July 2010: Wouter
        - Donation text added to README.
+       - Fix integer underflow in prefetch ttl creation from cache.  This
+         fixes a potential negative prefetch ttl.
 
 12 July 2010: Wouter
        - Changed the defaults for num-queries-per-thread/outgoing-range.
index 81e2f74e8ae9083a08447d48941214dc2ddd17bb..786ed6ae76b151976b40dc67dc270c4be78053b7 100644 (file)
@@ -430,9 +430,9 @@ tomsg(struct module_env* env, struct msgreply_entry* e, struct reply_info* r,
        msg->rep->flags = r->flags;
        msg->rep->qdcount = r->qdcount;
        msg->rep->ttl = r->ttl - now;
-       if(r->prefetch_ttl - now > 0)
+       if(r->prefetch_ttl > now)
                msg->rep->prefetch_ttl = r->prefetch_ttl - now;
-       else    msg->rep->prefetch_ttl = PREFETCH_TTL_CALC(r->prefetch_ttl);
+       else    msg->rep->prefetch_ttl = PREFETCH_TTL_CALC(msg->rep->ttl);
        msg->rep->security = r->security;
        msg->rep->an_numrrsets = r->an_numrrsets;
        msg->rep->ns_numrrsets = r->ns_numrrsets;