From a623fd8924359e391bc0d892270386facfe85677 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Tue, 31 Jul 2018 11:02:10 +0200 Subject: [PATCH] Make sure we're not using uninitialized values --- common/wireaddr.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/common/wireaddr.c b/common/wireaddr.c index ebe2d1fc3..86f1b35ac 100644 --- a/common/wireaddr.c +++ b/common/wireaddr.c @@ -431,12 +431,17 @@ bool parse_wireaddr_internal(const char *arg, struct wireaddr_internal *addr, return true; } + splitport = port; + if (!separate_address_and_port(tmpctx, arg, &ip, &splitport)) { + if (err_msg) { + *err_msg = "Error parsing hostname"; + } + return false; + } + /* An empty string means IPv4 and IPv6 (which under Linux by default * means just IPv6, and IPv4 gets autobound). */ - splitport = port; - if (wildcard_ok - && separate_address_and_port(tmpctx, arg, &ip, &splitport) - && streq(ip, "")) { + if (wildcard_ok && streq(ip, "")) { addr->itype = ADDR_INTERNAL_ALLPROTO; addr->u.port = splitport; return true;