Skip to content

Commit

Permalink
dco: fix crash when --multihome is used with --proto tcp
Browse files Browse the repository at this point in the history
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 #390
Change-Id: I61adc26ce2ff737e020c3d980902a46758cb23e5
Signed-off-by: Antonio Quartulli <[email protected]>
Acked-by: Gert Doering <[email protected]>
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg26953.html
Signed-off-by: Gert Doering <[email protected]>
  • Loading branch information
ordex authored and cron2 committed Sep 10, 2023
1 parent 34bf473 commit 0793eb1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/openvpn/dco.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,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;
}
Expand Down

0 comments on commit 0793eb1

Please sign in to comment.