diff options
author | Daniil Baturin <daniil@baturin.org> | 2018-08-04 19:37:31 +0200 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2018-08-04 19:37:31 +0200 |
commit | f8a647dd798fefcb51be9db8ff32d1e4e77d5134 (patch) | |
tree | 38a34d71b991b35b9b1f86731241ac25c9abf6f4 | |
parent | c7f24109e78115318042428a33b9ad3b98d3b5af (diff) | |
download | libvyosconfig-f8a647dd798fefcb51be9db8ff32d1e4e77d5134.tar.gz libvyosconfig-f8a647dd798fefcb51be9db8ff32d1e4e77d5134.zip |
T765: escape special characters on config formatting.
-rw-r--r-- | lib/vyos1x_renderer.ml | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/vyos1x_renderer.ml b/lib/vyos1x_renderer.ml index df2d7be..7ff4c4c 100644 --- a/lib/vyos1x_renderer.ml +++ b/lib/vyos1x_renderer.ml @@ -30,9 +30,9 @@ let make_indent indent level = String.make (level * indent) ' ' let render_values indent_str name values = match values with | [] -> Printf.sprintf "%s%s { }\n" indent_str name - | [v] -> Printf.sprintf "%s%s \"%s\"\n" indent_str name v + | [v] -> Printf.sprintf "%s%s \"%s\"\n" indent_str name (String.escaped v) | _ -> - let rendered = List.map (fun s -> Printf.sprintf "%s%s \"%s\"" indent_str name s) values in + let rendered = List.map (fun s -> Printf.sprintf "%s%s \"%s\"" indent_str name (String.escaped s)) values in let rendered = String.concat "\n" rendered in Printf.sprintf "%s\n" rendered |