From: TCY16 Date: Fri, 19 Aug 2022 12:48:47 +0000 (+0200) Subject: implement @wcawijngaards' review comment X-Git-Tag: release-1.18.0rc1~24^2~18^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8d939691a3a661ffce31bdcb3da9cb07b88ee65b;p=thirdparty%2Funbound.git implement @wcawijngaards' review comment --- diff --git a/sldns/wire2str.c b/sldns/wire2str.c index d0b89cb75..75753f910 100644 --- a/sldns/wire2str.c +++ b/sldns/wire2str.c @@ -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, "\"");