]> git.bitcoin.ninja Git - dnssec-prover/commitdiff
Refuse to include \s in the JSON output of a TXT record
authorMatt Corallo <git@bluematt.me>
Mon, 26 Feb 2024 03:02:21 +0000 (03:02 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 26 Feb 2024 20:44:36 +0000 (20:44 +0000)
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);
                        }
                }