Refuse to include \s in the JSON output of a TXT record
[dnssec-prover] / src / rr.rs
index f7faef51b58520d5600e0e106952a1f253ca53d8..86f5a807e12accf5504243fb1e145871b5775aa7 100644 (file)
--- a/src/rr.rs
+++ b/src/rr.rs
@@ -247,7 +247,7 @@ impl StaticRecord for Txt {
        fn name(&self) -> &Name { &self.name }
        fn json(&self) -> String {
                if let Ok(s) = core::str::from_utf8(&self.data) {
-                       if s.chars().all(|c| !c.is_control() && c != '"') {
+                       if s.chars().all(|c| !c.is_control() && c != '"' && c != '\\') {
                                return format!("{{\"type\":\"txt\",\"name\":\"{}\",\"contents\":\"{}\"}}", self.name.0, s);
                        }
                }