8 unsigned int dns_packet_copy(
const char *
buf,
unsigned int len,
unsigned int pos,
char *out,
unsigned int outlen)
23 if (pos >= len)
break;
25 if (ch >= 192)
return pos + 1;
37 unsigned int loop = 0;
38 unsigned int state = 0;
39 unsigned int firstcompress = 0;
43 unsigned int namelen = 0;
46 if (pos >= len)
goto PROTO; ch = buf[pos++];
47 if (++loop >= 1000)
goto PROTO;
50 if (namelen + 1 >
sizeof name)
goto PROTO; name[namelen++] = ch;
55 where = ch; where -= 192; where <<= 8;
56 if (pos >= len)
goto PROTO; ch = buf[pos++];
57 if (!firstcompress) firstcompress =
pos;
59 if (pos >= len)
goto PROTO; ch = buf[pos++];
60 if (++loop >= 1000)
goto PROTO;
62 if (ch >= 64)
goto PROTO;
63 if (namelen + 1 >
sizeof name)
goto PROTO; name[namelen++] = ch;
71 if (firstcompress)
return firstcompress;
unsigned int dns_packet_getname(const char *buf, unsigned int len, unsigned int pos, char **d)
unsigned int dns_packet_copy(const char *buf, unsigned int len, unsigned int pos, char *out, unsigned int outlen)
int dns_domain_copy(char **, const char *)
unsigned int dns_packet_skipname(const char *buf, unsigned int len, unsigned int pos)