]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Always escape BridgeDistribution value from torrc in descriptors.
authorAlexander Færøy <ahf@torproject.org>
Wed, 15 Jan 2020 17:18:30 +0000 (17:18 +0000)
committerAlexander Færøy <ahf@torproject.org>
Wed, 15 Jan 2020 17:18:30 +0000 (17:18 +0000)
When the BridgeDistribution value was added in commit
ebab5215252f9fa810ae091c335c5ae6e619faaf the check for whether the value
contains '\n' or '\r' was added as a requirement for whether or not the
value should be escaped.

This patch removes this check and makes sure we call `escaped()` on the
value every time before we add it to a descriptor.

See: https://bugs.torproject.org/32753

src/feature/relay/router.c

index e547b5a5531b8ba3a685577c101bd2df70f103cb..7ad0d1bd05c4d34ccb430d7720fcffa8f92f8967 100644 (file)
@@ -2914,9 +2914,8 @@ router_dump_router_to_string(routerinfo_t *router,
     } else {
       bd = "any";
     }
-    if (strchr(bd, '\n') || strchr(bd, '\r'))
-      bd = escaped(bd);
-    smartlist_add_asprintf(chunks, "bridge-distribution-request %s\n", bd);
+    smartlist_add_asprintf(chunks, "bridge-distribution-request %s\n",
+                           escaped(bd));
   }
 
   if (router->onion_curve25519_pkey) {