From patchwork Mon Jan 19 17:12:11 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4721 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:9186:b0:80a:3855:ce6a with SMTP id j6csp3322907maf; Mon, 19 Jan 2026 09:12:34 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUduqyJAudEklQM6f7Lyc4uZSbXYLEM+Mb3tA/gOTCzW7lUumlE6z21CB1y13r8/PmRbbS5Oh/lDXE=@openvpn.net X-Received: by 2002:a05:6830:2114:b0:7cf:dd08:356b with SMTP id 46e09a7af769-7cfdeec62c4mr7172682a34.38.1768842754103; Mon, 19 Jan 2026 09:12:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1768842754; cv=none; d=google.com; s=arc-20240605; b=QwbxrNpdT4NNWcB7uH7Lvgs3JN+paIXL8lN0PYi/M25k9lrqjWCCsbBSb3TKwkz/wv LzTM426lD/6JnMrcasdx+Tshfaa6l7Ys9fOatg4heiWhcbfc2X8FYgt0L20xfFS+8KbL iU3DnLGZ73mavp582CGzdsEPA2AUpWhwcKlI2XNjucvTfM8lD+paDDwzSuz2lt17SnyV JTY6HWy9XEMSp6Yu/0ErACt8ev53lkqmbXuXtb5Ovb3yDmfR5ecEQzc+yyococUCW/ck BugirhvGcqHENdc/NP3A/Q90LnKCh0Qeg3yIyCQfNmWSM3FCXisd76MqsAjpYSCW5Nck Yl1w== 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=6LuMWFcMYsgk0mKOQJpG2xEeOB559fgcGe9/6K8v4mg=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=ReDR5XQuJRcf6RqbhKjjihzkvMXWEufo5v4o89j6BWeiLRdsuWI/EZtBqBOMONpTey bxmxCLJ0q27w87BaF7cLuRa/ThyEw+bX/qzqbtNj7r9hnfvZwtoqwvbHf3J29/N8MhyN I3YuouM/ibwHuvfaKmDFCPE82wUc063prUNXY+t9L5XePrgzgAmJiqnWKpUUbWbRbs/n eZM4LIwP7njEzQ5k0H1e/UkxKsXLqFCgJtRmtFlZs2dnrSpCa02qQgSK+K8AwpRVNlDw 3BO0WLgkObK7f9R9a807HAkA6UaNbpn2IZwGSATI7ytJQN18vevN4Mk6/hZn9A4Qekky vHEw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=M6GJzXYH; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="Q/vQcnET"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=GVLk27ql; 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 46e09a7af769-7cfdf442ca2si5608138a34.121.2026.01.19.09.12.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Jan 2026 09:12:34 -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=M6GJzXYH; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="Q/vQcnET"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=GVLk27ql; 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=6LuMWFcMYsgk0mKOQJpG2xEeOB559fgcGe9/6K8v4mg=; b=M6GJzXYHR7RoL/gqT6+ZwmxLmy 53aKwY86RIKLah5bCYuNNKdDGnww/RI5RJC24WMTKHIEnL1ElXBjhNp2FGhq+cTsol77KV80muXVW ycuEauF0gvymIgkkHoxubPVgDOXYnQe/SQZUVJOMQRFStZnKSy5vb3CMrzN3lrfSdhl0=; Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1vhsno-0006lu-2A; Mon, 19 Jan 2026 17:12:32 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1vhsnm-0006ln-8G for openvpn-devel@lists.sourceforge.net; Mon, 19 Jan 2026 17:12:30 +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=SHozrDv/O6xO19unEbDe1NOds8/0hoOM9AYspiZOvfo=; b=Q/vQcnETI/gOzlpO/4jSJHBADi +6wfoPNNNFmg2ZwFSlRg9+GOqze6kCfibSwa5eFe7P6k2X5TX3c9X88x0u3JHAtzuwtrUA5kDF7V9 BFrUtHDb2OYR1J08jTV0Ls8XWVn8hr/1w5SJ0gIJTRXmcesDMuXnabuuqSE2iN+rn5EY=; 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=SHozrDv/O6xO19unEbDe1NOds8/0hoOM9AYspiZOvfo=; b=GVLk27qlwonJSGjEDyVs2z22Wr MOQWqZKs4ApSg7sjN0omgySKESSw5XFpU1Beup6JGKqgvC0KR62wnLgSHUNXBhVJh7uXIoFedb2nA EYQdxHPT9I6EZJkY5QTXLEcAaufo0i1+3qhGpXSKZ8P/Kyxk//x8J17zl5B6xTW9l1rk=; 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 1vhsnl-0001yj-CW for openvpn-devel@lists.sourceforge.net; Mon, 19 Jan 2026 17:12:30 +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 60JHCGoJ006113 for ; Mon, 19 Jan 2026 18:12:16 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 60JHCGqn006112 for openvpn-devel@lists.sourceforge.net; Mon, 19 Jan 2026 18:12:16 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Mon, 19 Jan 2026 18:12:11 +0100 Message-ID: <20260119171216.6100-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 While here, do some small C11 code cleanup. Reported-By: Joshua Rogers Found-By: ZeroPath (https://zeropath.com) Github: openvpn-private-issues#12 Change-Id: I5eac1b31ae40eb957e2c12ca6c37b491fef32847 Signed-off-by: Frank Lic [...] 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: 1vhsnl-0001yj-CW Subject: [Openvpn-devel] [PATCH v2] port-share: Check return value of fork() 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?1854766059779985338?= X-GMAIL-MSGID: =?utf-8?q?1854766059779985338?= From: Frank Lichtenheld While here, do some small C11 code cleanup. Reported-By: Joshua Rogers Found-By: ZeroPath (https://zeropath.com) Github: openvpn-private-issues#12 Change-Id: I5eac1b31ae40eb957e2c12ca6c37b491fef32847 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1470 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1470 This mail reflects revision 2 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/ps.c b/src/openvpn/ps.c index ed2d5c9f..e4c5794 100644 --- a/src/openvpn/ps.c +++ b/src/openvpn/ps.c @@ -800,12 +800,9 @@ port_share_open(const char *host, const char *port, const int max_initial_buf, const char *journal_dir) { - pid_t pid; socket_descriptor_t fd[2]; struct openvpn_sockaddr hostaddr; struct port_share *ps; - int status; - struct addrinfo *ai; ALLOC_OBJ_CLEAR(ps, struct port_share); ps->foreground_fd = -1; @@ -814,9 +811,9 @@ /* * Get host's IP address */ - - status = - openvpn_getaddrinfo(GETADDR_RESOLVE | GETADDR_FATAL, host, port, 0, NULL, AF_UNSPEC, &ai); + struct addrinfo *ai; + int status = openvpn_getaddrinfo(GETADDR_RESOLVE | GETADDR_FATAL, host, port, + 0, NULL, AF_UNSPEC, &ai); ASSERT(status == 0); ASSERT(sizeof(hostaddr.addr) >= ai->ai_addrlen); memcpy(&hostaddr.addr.sa, ai->ai_addr, ai->ai_addrlen); @@ -836,19 +833,22 @@ */ if (socketpair(PF_UNIX, SOCK_DGRAM, 0, fd) == -1) { - msg(M_WARN, "PORT SHARE: socketpair call failed"); + msg(M_WARN | M_ERRNO, "PORT SHARE: socketpair call failed"); goto error; } /* * Fork off background proxy process. */ - pid = fork(); + pid_t pid = fork(); - if (pid) + if (pid < 0) { - int status; - + msg(M_WARN | M_ERRNO, "PORT SHARE: fork failed"); + goto error; + } + else if (pid) + { /* * Foreground Process */ @@ -862,7 +862,7 @@ set_cloexec(fd[0]); /* wait for background child process to initialize */ - status = recv_control(fd[0]); + int status = recv_control(fd[0]); if (status == RESPONSE_INIT_SUCCEEDED) { /* note that this will cause possible EAGAIN when writing to