[or-cvs] r9168: Fix bug found by Keith Skinner: Treat malformed max-ports in (in tor/trunk: . src/common)

nickm at seul.org nickm at seul.org
Thu Dec 21 03:23:01 UTC 2006


Author: nickm
Date: 2006-12-20 22:22:59 -0500 (Wed, 20 Dec 2006)
New Revision: 9168

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/common/util.c
Log:
 r11668 at Kushana:  nickm | 2006-12-20 22:22:53 -0500
 Fix bug found by Keith Skinner: Treat malformed max-ports in address ranges as an error, and dont ignore errors with min-ports even if a max-port is present.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r11668] on c95137ef-5f19-0410-b913-86e773d04f59

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2006-12-21 02:59:15 UTC (rev 9167)
+++ tor/trunk/ChangeLog	2006-12-21 03:22:59 UTC (rev 9168)
@@ -78,6 +78,7 @@
       nameservers are configured in /etc/resolv.conf; instead, make the
       user fix resolv.conf or specify nameservers explicitly. (Resolves
       bug 363.)
+    - Stop accepting certain malformed ports in configured exit policies.
 
   o Controller features:
     - Have GETINFO dir/status/* work on hosts with DirPort disabled.

Modified: tor/trunk/src/common/util.c
===================================================================
--- tor/trunk/src/common/util.c	2006-12-21 02:59:15 UTC (rev 9167)
+++ tor/trunk/src/common/util.c	2006-12-21 03:22:59 UTC (rev 9168)
@@ -1755,15 +1755,16 @@
     char *endptr = NULL;
     *port_min_out = (uint16_t) tor_parse_long(port, 10, 1, 65535,
                                               NULL, &endptr);
-    if (*endptr == '-') {
+    if (*endptr == '-' && *port_min_out) {
       port = endptr+1;
       endptr = NULL;
       *port_max_out = (uint16_t) tor_parse_long(port, 10, 1, 65535, NULL,
                                                 &endptr);
       if (*endptr || !*port_max_out) {
         log_warn(LD_GENERAL,
-                 "Malformed port %s on address range rejecting.",
+                 "Malformed port %s on address range; rejecting.",
                  escaped(port));
+        return -1;
       }
     } else if (*endptr || !*port_min_out) {
       log_warn(LD_GENERAL,



More information about the tor-commits mailing list