aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-12-21 03:22:59 +0000
committerNick Mathewson <nickm@torproject.org>2006-12-21 03:22:59 +0000
commitca516311e3a84ecc739d36e8c0acd556e416f00e (patch)
tree5eff6856961d2676d993d5218df26f465e4f0e5b /src
parentd3f839d82c2e517eafb8f610004181302e3a3d20 (diff)
downloadtor-ca516311e3a84ecc739d36e8c0acd556e416f00e.tar
tor-ca516311e3a84ecc739d36e8c0acd556e416f00e.tar.gz
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
Diffstat (limited to 'src')
-rw-r--r--src/common/util.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 7e7b3827e..17b769d28 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,