dnsimple / dns_erlang

Erlang DNS library.
Apache License 2.0
95 stars 25 forks source link

Escape backslashes too #28

Open marc-vanderwal opened 1 year ago

marc-vanderwal commented 1 year ago

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.