]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Escape double quote when printing quoted string.
authorMark Andrews <marka@isc.org>
Sun, 22 Mar 2020 23:28:33 +0000 (10:28 +1100)
committerMark Andrews <marka@isc.org>
Thu, 30 Apr 2020 23:15:11 +0000 (09:15 +1000)
When we were printing quoted string, the double quotes where unescaped
leading to prematurely ending the quoted string.

(cherry picked from commit b02081d423dd9f0f038112a6fed32c15dfce248f)

lib/isccfg/parser.c

index a454864b232cfeab1883e5d8c3dfd601c8b6637e..794780068e752ee17501081d5c434b2f9d3130af 100644 (file)
@@ -1216,7 +1216,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, "\"");
 }