]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Future-proof and user-proof parse_bridge_line
authorNick Mathewson <nickm@torproject.org>
Sun, 3 Jul 2011 03:38:00 +0000 (23:38 -0400)
committerNick Mathewson <nickm@torproject.org>
Sun, 3 Jul 2011 04:02:13 +0000 (00:02 -0400)
src/or/config.c

index a94abb05014cb525dc10123f0155d62b27f7ae86..0082ff93972471f61db4790348a6471554dd3b3f 100644 (file)
@@ -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 {