aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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,