8 unsigned int dns_packet_copy(
const char *
buf,
unsigned int len,
unsigned int pos,
char *out,
unsigned int outlen)
11 if (pos >=
len) { errno = EPROTO ;
return 0; }
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;
54 where = ch; where -= 192; where <<= 8;
55 if (pos >=
len)
goto PROTO; ch =
buf[pos++];
56 if (!firstcompress) firstcompress = pos;
58 if (pos >=
len)
goto PROTO; ch =
buf[pos++];
59 if (++loop >= 1000)
goto PROTO;
61 if (ch >= 64)
goto PROTO;
62 if (namelen + 1 >
sizeof(
name))
goto PROTO;
name[namelen++] = ch;
70 if (firstcompress)
return firstcompress;
int dns_domain_copy(char **, const char *)
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)
char name[DNS_NAME6_DOMAIN]
void out(const char *s, unsigned int len)
void d(const char *home, const char *subdir, int uid, int gid, int mode)