Skip to content

Commit

Permalink
Merge pull request #7 from mythic-beasts/master
Browse files Browse the repository at this point in the history
Avoid segfault in "-f" mode.
  • Loading branch information
wojtekka authored Mar 26, 2019
2 parents 0dfeff8 + 227e054 commit 2729bd2
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions 6tunnel.c
Original file line number Diff line number Diff line change
Expand Up @@ -706,17 +706,20 @@ int main(int argc, char **argv)
source_hint = remote_hint[0];
}

if (source_hint == AF_INET && local_hint == AF_INET)
fprintf(stderr, "%s: warning: both local and remote addresses are IPv4\n", argv[0]);
if (ai != NULL) {

if (source_hint == AF_INET6 && local_hint == AF_INET6)
fprintf(stderr, "%s: warning: both local and remote addresses are IPv6\n", argv[0]);
if (source_hint == AF_INET && local_hint == AF_INET)
fprintf(stderr, "%s: warning: both local and remote addresses are IPv4\n", argv[0]);

tmp = xntop(ai->ai_addr);
debug("resolved to %s\n", tmp);
free(tmp);
if (source_hint == AF_INET6 && local_hint == AF_INET6)
fprintf(stderr, "%s: warning: both local and remote addresses are IPv6\n", argv[0]);

freeaddrinfo(ai);
tmp = xntop(ai->ai_addr);
debug("resolved to %s\n", tmp);
free(tmp);

freeaddrinfo(ai);
}

if (source_host != NULL) {
debug("resolving %s\n", source_host);
Expand Down

0 comments on commit 2729bd2

Please sign in to comment.