summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-10-13 19:53:34 +0000
committerNick Mathewson <nickm@torproject.org>2004-10-13 19:53:34 +0000
commitf14117bffdf22894d565e9c21c535bf06298f6cd (patch)
tree8faf0bf22421266b4fb83d7adfa7f7a6dfe9519a
parent149f57bdef9e12b1494a34a6356c54b92c64866c (diff)
downloadtor-f14117bffdf22894d565e9c21c535bf06298f6cd.tar.gz
tor-f14117bffdf22894d565e9c21c535bf06298f6cd.zip
fix warning about always-false comparison; detect too-large realport better
svn:r2465
-rw-r--r--src/or/rendservice.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 5851ddc238..6bcb709719 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -128,7 +128,8 @@ static void add_service(rend_service_t *service)
static rend_service_port_config_t *parse_port_config(const char *string)
{
int virtport;
- uint16_t realport;
+ int realport;
+ uint16_t p;
uint32_t addr;
char *endptr;
rend_service_port_config_t *result;
@@ -148,12 +149,11 @@ static rend_service_port_config_t *parse_port_config(const char *string)
realport = virtport;
addr = 0x7F000001u; /* 127.0.0.1 */
} else if (strchr(string, ':') || strchr(string, '.')) {
- if (parse_addr_port(string, NULL, &addr, &realport)<0) {
+ if (parse_addr_port(string, NULL, &addr, &p)<0) {
log_fn(LOG_WARN,"Unparseable address in hidden service port configuration");
return NULL;
}
- if (!realport)
- realport = virtport;
+ realport = p?p:virtport;
} else {
/* No addr:port, no addr -- must be port. */
realport = strtol(string, &endptr, 10);