2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

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.
This commit is contained in:
Mark Andrews
2020-03-23 10:28:33 +11:00
parent beb0be4d41
commit b02081d423

View File

@@ -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, "\"");
}