Changeset View
Changeset View
Standalone View
Standalone View
src/seeder/dns.cpp
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | enum class DNSResponseCode : uint8_t { | ||||
SERVER_FAILURE = 2, | SERVER_FAILURE = 2, | ||||
NAME_ERROR = 3, | NAME_ERROR = 3, | ||||
NOT_IMPLEMENTED = 4, | NOT_IMPLEMENTED = 4, | ||||
REFUSED = 5, | REFUSED = 5, | ||||
}; | }; | ||||
int parse_name(const uint8_t **inpos, const uint8_t *inend, | int parse_name(const uint8_t **inpos, const uint8_t *inend, | ||||
const uint8_t *inbuf, char *buf, size_t bufsize) { | const uint8_t *inbuf, char *buf, size_t bufsize) { | ||||
if (bufsize == 0) { | |||||
return -2; | |||||
} | |||||
size_t bufused = 0; | size_t bufused = 0; | ||||
int init = 1; | int init = 1; | ||||
do { | do { | ||||
if (*inpos == inend) { | if (*inpos == inend) { | ||||
return -1; | return -1; | ||||
} | } | ||||
// read length of next component | // read length of next component | ||||
int octet = *((*inpos)++); | int octet = *((*inpos)++); | ||||
▲ Show 20 Lines • Show All 603 Lines • Show Last 20 Lines |