Skip to content

Commit

Permalink
connectd: Do not clobber the for-variable when resolving over DNS
Browse files Browse the repository at this point in the history
We were using `i` as index variable in two nested loops. This works as long as
the DNS seed resolves to a single address, but will crash if the node has both
an A as well as an AAAA entry, at which point we'll try to index the hostname
without a matching entry.

Signed-off-by: Christian Decker <@cdecker>
  • Loading branch information
cdecker authored and niftynei committed Oct 18, 2019
1 parent 6b1b99d commit 3c3d7e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions connectd/connectd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1271,10 +1271,10 @@ static void add_seed_addrs(struct wireaddr_internal **addrs,
new_addrs = wireaddr_from_hostname(tmpctx, hostnames[i], DEFAULT_PORT,
NULL, broken_reply, NULL);
if (new_addrs) {
for (size_t i = 0; i < tal_count(new_addrs); i++) {
for (size_t j = 0; j < tal_count(new_addrs); j++) {
struct wireaddr_internal a;
a.itype = ADDR_INTERNAL_WIREADDR;
a.u.wireaddr = new_addrs[i];
a.u.wireaddr = new_addrs[j];
status_debug("Resolved %s to %s", hostnames[i],
type_to_string(tmpctx, struct wireaddr,
&a.u.wireaddr));
Expand Down

0 comments on commit 3c3d7e2

Please sign in to comment.