Handle trans id >= 0x8000, fix bug #37

This commit is contained in:
Erik Ekman
2009-01-03 20:13:31 +00:00
committed by Erik Ekman
parent 09c904f0c1
commit 62824e92ed
3 changed files with 30 additions and 3 deletions

View File

@@ -50,8 +50,8 @@ struct packet
struct query {
char name[QUERY_NAME_SIZE];
short type;
short id;
unsigned short type;
unsigned short id;
struct in_addr destination;
struct sockaddr from;
int fromlen;

View File

@@ -222,6 +222,7 @@ dns_decode(char *buf, size_t buflen, struct query *q, qr_t qr, char *packet, siz
ancount = ntohs(header->ancount);
id = ntohs(header->id);
id = id & 0xFFFF; /* Kill any sign extension */
rlen = 0;