diff options
author | 2025-05-06 14:56:54 +0200 | |
---|---|---|
committer | 2025-05-15 13:09:36 +0200 | |
commit | 8624daf9f27dc9c58e266319b44d5c0f8d6a67df (patch) | |
tree | 4fe22c242f58e0d029a8cb2a44ab24f4a42cbaf1 | |
parent | ovpn: don't drop skb's dst when xmitting packet (diff) | |
download | wireguard-linux-8624daf9f27dc9c58e266319b44d5c0f8d6a67df.tar.xz wireguard-linux-8624daf9f27dc9c58e266319b44d5c0f8d6a67df.zip |
selftest/net/ovpn: fix crash in case of getaddrinfo() failure
getaddrinfo() may fail with error code different from EAI_FAIL
or EAI_NONAME, however in this case we still try to free the
results object, thus leading to a crash.
Fix this by bailing out on any possible error.
Fixes: 959bc330a439 ("testing/selftests: add test tool and scripts for ovpn module")
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
Diffstat (limited to '')
-rw-r--r-- | tools/testing/selftests/net/ovpn/ovpn-cli.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/testing/selftests/net/ovpn/ovpn-cli.c b/tools/testing/selftests/net/ovpn/ovpn-cli.c index 69e41fc07fbc..c6372a1b4728 100644 --- a/tools/testing/selftests/net/ovpn/ovpn-cli.c +++ b/tools/testing/selftests/net/ovpn/ovpn-cli.c @@ -1753,8 +1753,11 @@ static int ovpn_parse_remote(struct ovpn_ctx *ovpn, const char *host, if (host) { ret = getaddrinfo(host, service, &hints, &result); - if (ret == EAI_NONAME || ret == EAI_FAIL) + if (ret) { + fprintf(stderr, "getaddrinfo on remote error: %s\n", + gai_strerror(ret)); return -1; + } if (!(result->ai_family == AF_INET && result->ai_addrlen == sizeof(struct sockaddr_in)) && @@ -1769,8 +1772,11 @@ static int ovpn_parse_remote(struct ovpn_ctx *ovpn, const char *host, if (vpnip) { ret = getaddrinfo(vpnip, NULL, &hints, &result); - if (ret == EAI_NONAME || ret == EAI_FAIL) + if (ret) { + fprintf(stderr, "getaddrinfo on vpnip error: %s\n", + gai_strerror(ret)); return -1; + } if (!(result->ai_family == AF_INET && result->ai_addrlen == sizeof(struct sockaddr_in)) && |