dns_erlang
dns_erlang copied to clipboard
Escape backslashes too
When a packet is received with a query for \\.test (that is, a name with two labels, one composed of only a backslash character, and the label “test”), labels_to_dname() decodes it to "\.test". Calling dname_to_labels() again on that result yields \.test (that is, a name with one label, “.test”) instead of \\.test.
The solution is to also backslash-escape the backslash character.