12unsigned int dns_packet_copy(
const char *buf,
unsigned int len,
unsigned int pos,
char *out,
unsigned int outlen)
15 if (pos >= len) { errno =
EPROTO;
return 0; }
27 if (pos >= len)
break;
29 if (ch >= 192)
return pos + 1;
41 unsigned int loop = 0;
42 unsigned int state = 0;
43 unsigned int firstcompress = 0;
47 unsigned int namelen = 0;
50 if (pos >= len)
goto PROTO;
52 if (++loop >= 1000)
goto PROTO;
55 if (namelen + 1 >
sizeof(name))
goto PROTO;
60 where = ch; where -= 192; where <<= 8;
61 if (pos >= len)
goto PROTO;
63 if (!firstcompress) firstcompress = pos;
65 if (pos >= len)
goto PROTO;
67 if (++loop >= 1000)
goto PROTO;
69 if (ch >= 64)
goto PROTO;
70 if (namelen + 1 >
sizeof(name))
goto PROTO;
79 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)
unsigned int dns_packet_skipname(const char *buf, unsigned int len, unsigned int pos)
int dns_domain_copy(char **, const char *)