Commit 6e220fa5 authored by Daniel Salzman's avatar Daniel Salzman

dname: dump '#' char in \ddd notation to fix possible collision with '\#' hex rdata notation

parent f984b951
......@@ -263,7 +263,12 @@ char *knot_dname_to_str(const knot_dname_t *name)
if (isalnum(c) != 0 || c == '-' || c == '_' || c == '*' ||
c == '/') {
res[str_len++] = c;
} else if (ispunct(c) != 0) {
} else if (ispunct(c) != 0 && c != '#') {
/* Exclusion of '#' character is to avoid possible
* collision with rdata hex notation '\#'. So it is
* encoded in \ddd notation.
*/
// Increase output size for \x format.
alloc_size += 1;
char *extended = realloc(res, alloc_size);
......
......@@ -69,6 +69,8 @@ str-test HINFO "" ""
TXT "\\" "\""
TXT "ahoj" "" "nevim"
NAPTR 20 0 "s" "SIP+D2U" "" sip._udp.wild.
\035leading.hash.char A 1.2.3.4
cname.to.hash.dname CNAME \035leading.hash.char
; CNAME loop
*.loop1 CNAME a.loop2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment