From: "plaisthos (Code Review)" Date: Wed, 25 Sep 2024 14:06:58 +0000 References: Reply-To: arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <1838210b47c0914e3119d4f491d6c9a6f8bb5c35-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="laqMa1AZ7Vs="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: Fix socketpair return status not being checked in port share code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: openvpn-devel --laqMa1AZ7Vs= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld. Hello flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/770?usp=3Demail to review the following change. Change subject: Fix socketpair return status not being checked in port shar= e code ...................................................................... Fix socketpair return status not being checked in port share code found by Coverity after tun_afunix introduced another call to socketpair, so it started to complain that we only check the return code in 4 of 5 cases. Change-Id: Id99a3ba13c0f1d0bc7e4699fb67ee9dff6221639 --- M src/openvpn/ps.c 1 file changed, 7 insertions(+), 1 deletion(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/70/770/1 diff --git a/src/openvpn/ps.c b/src/openvpn/ps.c index 4ca3a12..129f65c 100644 --- a/src/openvpn/ps.c +++ b/src/openvpn/ps.c @@ -234,7 +234,12 @@ } else { - socketpair(PF_UNIX, SOCK_DGRAM, 0, sd_null); + if (!socketpair(AF_UNIX, SOCK_DGRAM, 0, sd_null)) + { + msg(M_WARN|M_ERRNO, "PORT SHARE: socketpair failed -- unab= le to communicate with background process " + "(%d, %d)", sd, sd_send); + goto done; + } memcpy(CMSG_DATA(h), &sd_null[0], sizeof(sd_null[0])); } @@ -246,6 +251,7 @@ ); } +done: close_socket_if_defined(sd_null[0]); close_socket_if_defined(sd_null[1]); free(mesg.msg_control); -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/770?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Id99a3ba13c0f1d0bc7e4699fb67ee9dff6221639 Gerrit-Change-Number: 770 Gerrit-PatchSet: 1 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --laqMa1AZ7Vs= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld.

plaisthos would like flichtenheld to review this change.

Vi= ew Change

Fix socketpair return status not being checked in port share =
code

found by Coverity after tun_afunix introduced another call tosocketpair, so it started to complain that we only check the
return co= de in 4 of 5 cases.

Change-Id: Id99a3ba13c0f1d0bc7e4699fb67ee9dff622= 1639
---
M src/openvpn/ps.c
1 file changed, 7 insertions(+), 1 del= etion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/cha=
nges/70/770/1
diff --git a/src/openvpn/ps.c b/src/openvpn/ps.c
index 4ca3a12..129f65c 100644
--- a/src/openvpn= /ps.c
+++ b/src/openvpn/ps.c
@@ -234,7 +234= ,12 @@
}
else
<= span> {

- = socketpair(PF_UNIX, SOCK_DGRAM, 0, sd_null);
+ if (!socketpair(AF_UNIX, SOCK_DG= RAM, 0, sd_null))
+ = {
+ = msg(M_WARN|M_ERRNO, "PORT SHARE: socketpair failed -- unable t= o communicate with background process "
+ "(%d, %d)", sd, sd_s= end);
+ = goto done;
+ = }
memcpy(CMSG_DATA(h), &sd_null[0], s= izeof(sd_null[0]));
}

= @@ -246,6 +251,7 @@
);
}

+done:
close_socket_if_defined(sd_null[= 0]);
close_socket_if_defined(sd_null[1]); free(mesg.msg_control);

<= p>To view, visit change 770. To unsubscribe, or for help writing mail filters,= visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id99a3ba13c0f1d0bc7e4699fb67= ee9dff6221639
Gerrit-Change-Number: 770
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newchange
--laqMa1AZ7Vs=--