diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-12-21 03:22:59 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-12-21 03:22:59 +0000 |
commit | ca516311e3a84ecc739d36e8c0acd556e416f00e (patch) | |
tree | 5eff6856961d2676d993d5218df26f465e4f0e5b | |
parent | d3f839d82c2e517eafb8f610004181302e3a3d20 (diff) | |
download | tor-ca516311e3a84ecc739d36e8c0acd556e416f00e.tar.gz tor-ca516311e3a84ecc739d36e8c0acd556e416f00e.zip |
r11668@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.
svn:r9168
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | src/common/util.c | 5 |
2 files changed, 4 insertions, 2 deletions
@@ -78,6 +78,7 @@ Changes in version 0.1.2.5-xxxx - 200?-??-?? 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. diff --git a/src/common/util.c b/src/common/util.c index 7e7b3827ec..17b769d28c 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -1755,15 +1755,16 @@ parse_port_range(const char *port, uint16_t *port_min_out, 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, |