From: Mark Andrews Date: Sun, 22 Mar 2020 23:28:33 +0000 (+1100) Subject: Escape double quote when printing quoted string. X-Git-Tag: v9.17.2~107^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b02081d423dd9f0f038112a6fed32c15dfce248f;p=thirdparty%2Fbind9.git Escape double quote when printing quoted string. When we were printing quoted string, the double quotes where unescaped leading to prematurely ending the quoted string. --- diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c index 4cef5bc83f9..154311ace43 100644 --- a/lib/isccfg/parser.c +++ b/lib/isccfg/parser.c @@ -1671,7 +1671,12 @@ cfg_print_ustring(cfg_printer_t *pctx, const cfg_obj_t *obj) { static void print_qstring(cfg_printer_t *pctx, const cfg_obj_t *obj) { cfg_print_cstr(pctx, "\""); - cfg_print_ustring(pctx, obj); + for (size_t i = 0; i < obj->value.string.length; i++) { + if (obj->value.string.base[i] == '"') { + cfg_print_cstr(pctx, "\\"); + } + cfg_print_chars(pctx, &obj->value.string.base[i], 1); + } cfg_print_cstr(pctx, "\""); }