Handle integer overflow in uid counter. Fixes rare crashes in cache code.

This commit is contained in:
Simon Kelley
2014-03-16 22:56:58 +00:00
parent 0c8584eabc
commit 3f7483e816
4 changed files with 23 additions and 16 deletions

View File

@@ -1456,7 +1456,7 @@ size_t answer_request(struct dns_header *header, char *limit, size_t qlen,
{
char *name = daemon->namebuff;
unsigned char *p, *ansp, *pheader;
int qtype, qclass;
unsigned int qtype, qclass;
struct all_addr addr;
int nameoffset;
unsigned short flag;
@@ -2016,7 +2016,7 @@ size_t answer_request(struct dns_header *header, char *limit, size_t qlen,
strcpy(name, cname_target);
/* check if target interface_name */
if (crecp->addr.cname.uid == -1)
if (crecp->addr.cname.uid == 0)
goto intname_restart;
else
goto cname_restart;