aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrank Lichtenheld2024-03-25 08:14:48 +0100
committerGert Doering2024-03-25 17:53:34 +0100
commite8c629fe64c67ea0a8454753be99db44df7ce53e (patch)
tree849592cb977864079cf014e09d940080d3663540 /src
parent6a60d1bef424088df55f4d07efd45ce080fc7132 (diff)
downloadopenvpn-e8c629fe64c67ea0a8454753be99db44df7ce53e.zip
openvpn-e8c629fe64c67ea0a8454753be99db44df7ce53e.tar.gz
phase2_tcp_server: fix Coverity issue 'Dereference after null check'
As Coverity says: Either the check against null is unnecessary, or there may be a null pointer dereference. In phase2_tcp_server: Pointer is checked against null but then dereferenced anyway There is only one caller (link_socket_init_phase2) and it already has an ASSERT(sig_info). So use that here was well. v2: - fix cleanly by actually asserting that sig_info is defined Change-Id: I8ef199463d46303129a3f563fd9eace780a58b8a Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com> Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org> Message-Id: <20240325071448.12143-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg28452.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
Diffstat (limited to 'src')
-rw-r--r--src/openvpn/socket.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c
index 57eaee2..d2b82d5 100644
--- a/src/openvpn/socket.c
+++ b/src/openvpn/socket.c
@@ -2005,7 +2005,8 @@ static void
phase2_tcp_server(struct link_socket *sock, const char *remote_dynamic,
struct signal_info *sig_info)
{
- volatile int *signal_received = sig_info ? &sig_info->signal_received : NULL;
+ ASSERT(sig_info);
+ volatile int *signal_received = &sig_info->signal_received;
switch (sock->mode)
{
case LS_MODE_DEFAULT:
@@ -2031,7 +2032,7 @@ phase2_tcp_server(struct link_socket *sock, const char *remote_dynamic,
false);
if (!socket_defined(sock->sd))
{
- register_signal(sig_info, SIGTERM, "socket-undefiled");
+ register_signal(sig_info, SIGTERM, "socket-undefined");
return;
}
tcp_connection_established(&sock->info.lsa->actual);