size_t no underflow.

git-svn-id: file:///svn/unbound/trunk@681 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2007-10-16 14:39:27 +00:00
parent 189fafa1da
commit 631ccb58bf
2 changed files with 4 additions and 2 deletions

View 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.

View 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;
}