]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
implement @wcawijngaards' review comment
authorTCY16 <tom@nlnetlabs.nl>
Fri, 19 Aug 2022 12:48:47 +0000 (14:48 +0200)
committerTCY16 <tom@nlnetlabs.nl>
Fri, 19 Aug 2022 12:48:47 +0000 (14:48 +0200)
sldns/wire2str.c

index d0b89cb75c0a86b45ee3ff7adec54156b782f064..75753f910a575c7031d2777311aa31b8fb2a40d8 100644 (file)
@@ -1157,11 +1157,14 @@ static int sldns_wire2str_svcparam_dohpath2str(char** s,
        w += sldns_str_print(s, slen, "=\"");
 
        /* RC6570#section-2.1 specifies that the '\' (and other non-letter
-        * characters in the URI) are "intended to be copied literally" */
+        * characters in the URI) are "intended to be copied literally" (as 
+        * opposed to the alpn printing) */
        for (i = 0; i < data_len; i++) {
-               // @TODO do a check like isprint()?
-
-               w += sldns_str_print(s, slen, "%c", data[i]);
+               if (!isprint(data[i])) {
+                       w += sldns_str_print(s, slen, "\\%03u", (unsigned) data[i]);
+               } else {
+                       w += sldns_str_print(s, slen, "%c", data[i]);
+               }
        }
 
        w += sldns_str_print(s, slen, "\"");