[tor-commits] [tor/master] Future-proof and user-proof parse_bridge_line

nickm at torproject.org nickm at torproject.org
Mon Jul 11 20:01:37 UTC 2011


commit 72125389979af60b659dc469159ea9be397a2ffa
Author: Nick Mathewson <nickm at torproject.org>
Date:   Sat Jul 2 23:38:00 2011 -0400

    Future-proof and user-proof parse_bridge_line
---
 src/or/config.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/or/config.c b/src/or/config.c
index a94abb0..0082ff9 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -4597,8 +4597,13 @@ parse_bridge_line(const char *line, int validate_only)
   field1 = smartlist_get(items, 0);
   smartlist_del_keeporder(items, 0);
 
-  if (!strstr(field1, ".")) { /* new-style bridge line */
+  if (!(strstr(field1, ".") || strstr(field1, ":"))) {
+    /* new-style bridge line */
     transport_name = field1;
+    if (smartlist_len(items) < 1) {
+      log_warn(LD_CONFIG, "Too few items to Bridge line.");
+      goto err;
+    }
     addrport = smartlist_get(items, 0);
     smartlist_del_keeporder(items, 0);
   } else {





More information about the tor-commits mailing list