Changeset View
Changeset View
Standalone View
Standalone View
src/seeder/dns.cpp
Show First 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | do { | ||||
return ParseNameStatus::InputError; | return ParseNameStatus::InputError; | ||||
} | } | ||||
octet--; | octet--; | ||||
buf[bufused++] = c; | buf[bufused++] = c; | ||||
} | } | ||||
} while (1); | } while (1); | ||||
} | } | ||||
// 0: ok | int write_name(uint8_t **outpos, const uint8_t *outend, const char *name, | ||||
// -1: label > MAX_LABEL_LENGTH characters | |||||
// -2: insufficent space in output | |||||
// -3: two subsequent dots | |||||
static int write_name(uint8_t **outpos, const uint8_t *outend, const char *name, | |||||
int offset) { | int offset) { | ||||
while (*name != 0) { | while (*name != 0) { | ||||
const char *dot = strchr(name, '.'); | const char *dot = strchr(name, '.'); | ||||
const char *fin = dot; | const char *fin = dot; | ||||
if (!dot) { | if (!dot) { | ||||
fin = name + strlen(name); | fin = name + strlen(name); | ||||
} | } | ||||
if (fin - name > MAX_LABEL_LENGTH) { | if (fin - name > MAX_LABEL_LENGTH) { | ||||
return -1; | return -1; | ||||
▲ Show 20 Lines • Show All 538 Lines • Show Last 20 Lines |