Skip to content
Snippets Groups Projects
Commit f39704e7 authored by Lubos Slovak's avatar Lubos Slovak
Browse files

Added check for domain name format.

- If labels are not parsed well, error is returned

Warning: This check was commented as if it was wrong in some case.
         Don't know why and enabling it may cause some problems.
parent 99aff00e
No related branches found
No related tags found
No related merge requests found
......@@ -270,12 +270,12 @@ static int knot_dname_find_labels(knot_dname_t *dname, int alloc)
}
// TODO: how to check if the domain name has right format?
// if (pos - name < size && *pos != '0') {
// dbg_dname("Wrong wire format of domain name!\n");
// dbg_dname("Position: %d, character: %d, expected"
// " size: %d\n", pos - name, *pos, size);
// return -1;
// }
if (pos - name > size || *pos != '\0') {
dbg_dname("Wrong wire format of domain name!\n");
dbg_dname("Position: %d, character: %d, expected"
" size: %d\n", pos - name, *pos, size);
return -1;
}
if (alloc) {
dname->labels
......
......@@ -797,6 +797,8 @@ int knot_packet_parse_from_wire(knot_packet_t *packet,
packet->parsed = pos;
}
knot_packet_dump(packet);
if (question_only) {
return KNOT_EOK;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment