From patchwork Tue Dec 16 11:15:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4688 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:8f10:b0:7b1:439f:bdf with SMTP id mq16csp391643mab; Tue, 16 Dec 2025 03:16:05 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXLJuph6uK4Zm+1SVEZj+u3dAEOKP25JUmUJCWa5zsMHHC+dihltusbMx2/VmzqEHD88X9PYIyF4OU=@openvpn.net X-Google-Smtp-Source: AGHT+IHlPbnGyzSJpiWpEq/NyS9yIF99l3DvIKQDMfXG5KUTolTLQRZ+kMuFm5PfPskmMaPKb9/G X-Received: by 2002:a05:6808:4f08:b0:450:c456:10e3 with SMTP id 5614622812f47-455ac860575mr6454747b6e.25.1765883765710; Tue, 16 Dec 2025 03:16:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1765883765; cv=none; d=google.com; s=arc-20240605; b=Mx2FdG+khYIIr1RtUpMa5PFF6rnpChtPgTfsgvFHrVCPESGI4blS97RrSulajFR/Vm EB/0aSKDymE+fm++NyLLImfGu//WtEkEGfqyMuSuaosZm9rBgXRJv2D+KkHSAhwy/HC1 mZqmgbhjTNlbY3jOebtaYHE7XcUjSNgY7u469dkpLgzXY4gVtKYgfqBV5pU3FX8NbedM ydK5eT1WkJflR8KviHIMWWTQK+k4vHaQvCqi3F3gtvYf/a20zyy0JR2vUICx/tDI/FW3 6l6JfP5XU6DILK/b8JCQA3hkrZlpk7FzRzhWMOS8Ibr7YsQc0hvdYfwqB6W6UL8gXFzZ bBMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=Fxkq/ZXqFb0NpsZ6fVgcdu7nRe0ujrFHRe254cR46YE=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=GPycEZRZCwGrYe6fhRSY3tM3VybJrGaGTPvXNBoACGVRvYdJLkuPaukXRmsHSEIBgI mHQK15+sq+wNfiaOKt/3MxjcK1Cd73m8c88gOdkgY2P5bj9fqFfBkHpsJEd2qk1wAYdY pkTWNheV7D6Zh81qh5rAIJoqmOh1c/70m6wGI9X0rbXTBQor5hz5NHKDneRVIuS9KRbO Evti5da6eXHtNM15Uht24I1hm10BU8Ec3fAd2wgEHV1oiCYuK6oHLSE2neKF8BqU182q epGtI3m2WdNRVTR6e4tcYBfWzfIna348si5CeilLzG8Ehh1iTeIJgEXLMeCWYCGq0fDA tNgQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=g0StGMGK; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=iiyuCzs9; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=ke+ca8zL; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 586e51a60fabf-3f9dbc007f5si1492171fac.67.2025.12.16.03.16.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Dec 2025 03:16:05 -0800 (PST) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=g0StGMGK; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=iiyuCzs9; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=ke+ca8zL; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Fxkq/ZXqFb0NpsZ6fVgcdu7nRe0ujrFHRe254cR46YE=; b=g0StGMGKaSKr7GH4sn/a+pcgAP F8zWCo1ZoeQdEfGzcC701meEghH+m5l8t0WXu9uKk6Yu76jfXeXo/oxZlSvmcjnTcYGcRgk8tk73r SO/eW251ex1eEwxVzE+UNFqhAiEge/fdVvfmk+OVeRtEbUWqwMXdkba35coyZgnre8vc=; Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1vVT27-0007pD-Mb; Tue, 16 Dec 2025 11:15:59 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1vVT26-0007p5-Du for openvpn-devel@lists.sourceforge.net; Tue, 16 Dec 2025 11:15:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=y+neTb9IHcTPL4OyQKZndYipPTCFbPpz8T/m115Pu6U=; b=iiyuCzs9TTEvA/UCgOAnPRLEqe BAmtzMguggp30SLrm7jVO/uoE+RorqfpkiwIL5YjSMQQTcJFkPHQ2PiqLiZQBjgDIWbGgECtpdMbl zZ3T6mTBaw9Vk7JPs6VqycurwVr5VYYd/sFYWTO4AIVpslU7Nb9wMOzmxJgVHmRtkWso=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=y+neTb9IHcTPL4OyQKZndYipPTCFbPpz8T/m115Pu6U=; b=ke+ca8zLcd9PQxSrTlhPXG/yeW dHJMKYqZtP8qyHPQDEzuMGtwle9Hrw65A/bStwNpEX6NngdiYU/F8yeTlaIh6h4njpbhD09Ry0MD5 RYYgaR/FU0+zLQGuckIDUNhqaiOZVHvtofbB8C2lkjhng2MEApKpvyH6Jlw8c1FE1hJQ=; Received: from [193.149.48.134] (helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1vVT24-0004hK-QD for openvpn-devel@lists.sourceforge.net; Tue, 16 Dec 2025 11:15:58 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.18.1/8.18.1) with ESMTP id 5BGBFi1L027152 for ; Tue, 16 Dec 2025 12:15:44 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 5BGBFiRR027151 for openvpn-devel@lists.sourceforge.net; Tue, 16 Dec 2025 12:15:44 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Tue, 16 Dec 2025 12:15:39 +0100 Message-ID: <20251216111544.27133-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.51.2 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-2.hosts.colo.sdot.me", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Frank Lichtenheld Handle failure explicitly instead of the implicit handling by "while (buffer_i < r)". Backport of 18d1b1fe008a4bbfd5a56ca7bb59f6f8cb58114a and the relevant type fix of 5e5ead5ba019fc2a8266f77a7d840b30fd545198 Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1vVT24-0004hK-QD Subject: [Openvpn-devel] [PATCH v1] multi: Warn about failing read in multi_process_file_closed() X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1851663335119436064?= X-GMAIL-MSGID: =?utf-8?q?1851663335119436064?= From: Frank Lichtenheld 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 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to release/2.6. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1444 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Antonio Quartulli 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 = 0; - int r = read(m->top.c2.inotify_fd, buffer, INOTIFY_EVENT_BUFFER_SIZE); + ssize_t buffer_i = 0; + ssize_t r = 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) {