From: "cron2 (Code Review)" Date: Mon, 29 Dec 2025 16:12:54 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., antonio@...2726... Message-ID: <9db7c4c89e05511722347d47a337cfbbf29a6045-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="rewoRdJ/sfU="; 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: flichtenheld Cc: plaisthos , openvpn-devel --rewoRdJ/sfU= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/14= 44?usp=3Demail ) 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 Acked-by: Antonio Quartulli Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1444 Message-Id: <20251216111544.27133-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35= 113.html Signed-off-by: Gert Doering --- M src/openvpn/multi.c 1 file changed, 7 insertions(+), 2 deletions(-) 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: merged Gerrit-Project: openvpn Gerrit-Branch: release/2.6 Gerrit-Change-Id: I950863eeba67b8c006c794245a1a08752cd79fb0 Gerrit-Change-Number: 1444 Gerrit-PatchSet: 2 Gerrit-Owner: cron2 Gerrit-Reviewer: ordex Gerrit-Reviewer: plaisthos Gerrit-CC: flichtenheld Gerrit-CC: openvpn-devel --rewoRdJ/sfU= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 sub= mitted this change.

View Change

multi: Warn about failing read in multi_process_=
file_closed()

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

Backport of 18d1b1fe= 008a4bbfd5a56ca7bb59f6f8cb58114a and the relevant
type fix of 5e5ead5ba0= 19fc2a8266f77a7d840b30fd545198

Reported-by: Marc Heuse <marc@...1665...= 953...>
Github: openvpn-private-issues#101
Change-Id: I950863eeba6= 7b8c006c794245a1a08752cd79fb0
Signed-off-by: Gert Doering <gert@...1711...= 96...>
Acked-by: Antonio Quartulli <antonio@...2726...>
Gerr= it URL: https://gerrit.openvpn.net/c/openvpn/+/1444
Message-Id: <2025= 1216111544.27133-1-gert@...1296...>
URL: https://www.mail-archive.com= /openvpn-devel@lists.sourceforge.net/msg35113.html
Signed-off-by: Gert D= oering <gert@...1296...>
---
M src/openvpn/multi.c
1 file ch= anged, 7 insertions(+), 2 deletions(-)

diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
i= ndex 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 buffe= r[INOTIFY_EVENT_BUFFER_SIZE];
- size_t buffer_i =3D 0;
- int r =3D read(m->top.c2.inotify_fd, buffer, INOTIFY_EV= ENT_BUFFER_SIZE);
+ = ssize_t buffer_i =3D 0;
+ ssize_t r =3D read(m->top.c2.inotify_fd, buffer, INOTIFY_EVENT= _BUFFER_SIZE);
+ i= f (r < 0)
+ {
+ msg(M_WARN | = M_ERRNO, "MULTI: multi_process_file_closed error");
+ return;

+ }

while (buffer_i < r)

{

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

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: I950863eeba67b8c006c794245a1= a08752cd79fb0
Gerrit-Change-Number: 1444
Gerrit-PatchSet: 2
Gerrit-Owner: cron2 <gert@...1296...>
Gerrit-Reviewer: ordex <antonio@...2726...&= gt;
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: flichtenheld <frank@...2641...&g= t;
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --rewoRdJ/sfU=--