From: "cron2 (Code Review)" Date: Tue, 16 Dec 2025 07:20:39 +0000 References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: <8f6455eee97d1de5bf96bd2ef0ee252c5ee6004e-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="Vvqpan+11qU="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[release/2.6]: multi: Warn about failing read in multi_process_file_closed() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --Vvqpan+11qU= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1444?usp=3Demail to review the following change. Change subject: multi: Warn about failing read in multi_process_file_closed= () ...................................................................... multi: Warn about failing read in multi_process_file_closed() Handle failure explicitly instead of the implicit handling by "while (buffer_i < r)". Backport of 18d1b1fe008a4bbfd5a56ca7bb59f6f8cb58114a and the relevant type fix of 5e5ead5ba019fc2a8266f77a7d840b30fd545198 Reported-by: Marc Heuse Github: openvpn-private-issues#101 Change-Id: I950863eeba67b8c006c794245a1a08752cd79fb0 Signed-off-by: Gert Doering --- M src/openvpn/multi.c 1 file changed, 7 insertions(+), 2 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/44/1444/1 diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index 94e623b..69497a6 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -2830,8 +2830,13 @@ multi_process_file_closed(struct multi_context *m, const unsigned int mpp_= flags) { char buffer[INOTIFY_EVENT_BUFFER_SIZE]; - size_t buffer_i =3D 0; - int r =3D read(m->top.c2.inotify_fd, buffer, INOTIFY_EVENT_BUFFER_SIZE= ); + ssize_t buffer_i =3D 0; + ssize_t r =3D read(m->top.c2.inotify_fd, buffer, INOTIFY_EVENT_BUFFER_= SIZE); + if (r < 0) + { + msg(M_WARN | M_ERRNO, "MULTI: multi_process_file_closed error"); + return; + } while (buffer_i < r) { -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1444?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newchange Gerrit-Project: openvpn Gerrit-Branch: release/2.6 Gerrit-Change-Id: I950863eeba67b8c006c794245a1a08752cd79fb0 Gerrit-Change-Number: 1444 Gerrit-PatchSet: 1 Gerrit-Owner: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos --Vvqpan+11qU= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: plaisthos.

cron2 would like plaisthos to review this change.

V= iew Change

multi: Warn about failing read in multi_pro=
cess_file_closed()

Handle failure explicitly instead of the implicit=
handling by "while (buffer_i < r)".

Backport of 18d= 1b1fe008a4bbfd5a56ca7bb59f6f8cb58114a and the relevant
type fix of 5e5ea= d5ba019fc2a8266f77a7d840b30fd545198

Reported-by: Marc Heuse <marc= @...2953...>
Github: openvpn-private-issues#101
Change-Id: I950863= eeba67b8c006c794245a1a08752cd79fb0
Signed-off-by: Gert Doering <gert@= ...1296...>
---
M src/openvpn/multi.c
1 file changed, 7 inserti= ons(+), 2 deletions(-)

git pull ssh://gerrit.ope=
nvpn.net:29418/openvpn refs/changes/44/1444/1
diff --git a/src/open=
vpn/multi.c b/src/openvpn/multi.c
index 94e623b..69497a6 10= 0644
--- a/src/openvpn/multi.c
+++ b/src/op= envpn/multi.c
@@ -2830,8 +2830,13 @@
multi= _process_file_closed(struct multi_context *m, const unsigned int mpp_flags)=
{
char buffer[INOTIFY_EVENT_BUFFER_S= IZE];
- size_t buffe= r_i =3D 0;
- int r = =3D read(m->top.c2.inotify_fd, buffer, INOTIFY_EVENT_BUFFER_SIZE);
+ ssize_t buffer_i =3D = 0;
+ ssize_t r =3D= read(m->top.c2.inotify_fd, buffer, INOTIFY_EVENT_BUFFER_SIZE);+ if (r < 0)
= + {
+ msg(M_WARN | M_ERRNO, "MULTI: m= ulti_process_file_closed error");
+ return;
+ }

while (buffer_i= < r)
{

To view= , visit = change 1444. To unsubscribe, or for help writing mail filters, visit settings.

<= div itemscope itemtype=3D"http://schema.org/EmailMessage">
<= meta itemprop=3D"name" content=3D"View Change"/>
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: I950863eeba67b8c006c794245a1= a08752cd79fb0
Gerrit-Change-Number: 1444
Gerrit-PatchSet: 1
Gerrit-Owner: cron2 <gert@...1296...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: flichtenheld <frank@...2641...&g= t;
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
= --Vvqpan+11qU=--