aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Quartulli2023-08-16 01:15:55 +0200
committerGert Doering2023-09-10 17:26:16 +0200
commit70ef43f2b9b938256e0f689f4ddba0d6fbb3a371 (patch)
treeff63bc4aefcdb059e2e4a03ddf828cbfca7066f6
parenta22f017ac249df1170a9480b5d7a1f9cc81201e5 (diff)
downloadopenvpn-70ef43f2b9b938256e0f689f4ddba0d6fbb3a371.zip
openvpn-70ef43f2b9b938256e0f689f4ddba0d6fbb3a371.tar.gz
dco: fix crash when --multihome is used with --proto tcp
Although it's a combination of options that is not really useful, when specifying --multihome along with --proto tcp and DCO is enabled, OpenVPN will crash while attempting to access c2.link_socket_actual (NULL for the TCP case) in order to retrieve the local address (in function dco_multi_get_localaddr()) Prevent crash by running this code only if proto is UDP. The same check is already performed in socket.c/h for the non-DCO case. Github: fixes OpenVPN/openvpn#390 Change-Id: I61adc26ce2ff737e020c3d980902a46758cb23e5 Signed-off-by: Antonio Quartulli <a@unstable.cc> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20230815231555.6465-1-a@unstable.cc> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg26953.html Signed-off-by: Gert Doering <gert@greenie.muc.de> (cherry picked from commit 0793eb105c5720c4eb31af71c9db81459439e510)
-rw-r--r--src/openvpn/dco.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/openvpn/dco.c b/src/openvpn/dco.c
index 308578b..3615bab 100644
--- a/src/openvpn/dco.c
+++ b/src/openvpn/dco.c
@@ -511,7 +511,7 @@ dco_multi_get_localaddr(struct multi_context *m, struct multi_instance *mi,
#if ENABLE_IP_PKTINFO
struct context *c = &mi->context;
- if (!(c->options.sockflags & SF_USE_IP_PKTINFO))
+ if (!proto_is_udp(c->c2.link_socket->info.proto) || !(c->options.sockflags & SF_USE_IP_PKTINFO))
{
return false;
}