]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
size_t no underflow.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 16 Oct 2007 14:39:27 +0000 (14:39 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 16 Oct 2007 14:39:27 +0000 (14:39 +0000)
git-svn-id: file:///svn/unbound/trunk@681 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
util/data/msgreply.c

index 229789f8177de94869ae63ba550a78697569a295..1b25a456d7fcf45db9d5195e40fc717934107568 100644 (file)
@@ -10,6 +10,7 @@
        - dname_pkt_copy checks length of result, to protect result buffers.
          prints an error, this should not happen. Bad strings should have
          been rejected earlier in the program.
+       - remove a size_t underflow from msgreply size func.
 
 15 October 2007: Wouter
        - nicer warning.
index 91f9256afa11c3d76850c5d9efb6a04a59ffbe85..77dae93465ecf625bca4e541cb430756bbcf3b33 100644 (file)
@@ -529,8 +529,9 @@ msgreply_sizefunc(void* k, void* d)
        struct msgreply_entry* q = (struct msgreply_entry*)k;
        struct reply_info* r = (struct reply_info*)d;
        size_t s = sizeof(struct msgreply_entry) + sizeof(struct reply_info)
-               + q->key.qname_len + lock_get_mem(&q->entry.lock);
-       s += (r->rrset_count-1) * sizeof(struct rrset_ref);
+               + q->key.qname_len + lock_get_mem(&q->entry.lock)
+               - sizeof(struct rrset_ref);
+       s += r->rrset_count * sizeof(struct rrset_ref);
        s += r->rrset_count * sizeof(struct ub_packed_rrset_key*);
        return s;
 }