From patchwork Thu Jan 22 15:47:51 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Lichtenheld X-Patchwork-Id: 4730 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:220f:b0:80a:3855:ce6a with SMTP id q15csp506213mag; Thu, 22 Jan 2026 07:48:18 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVviH4WCsFTs1ZWiMC0+dXhU+jRONbFd4EHDKUSi8LyCYx9gLla7ECudHqgcM3qd+wHKjDyMnwP8Js=@openvpn.net X-Received: by 2002:a05:6871:ac58:b0:408:7057:c809 with SMTP id 586e51a60fabf-4087057ce1amr2200974fac.44.1769096897394; Thu, 22 Jan 2026 07:48:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1769096897; cv=none; d=google.com; s=arc-20240605; b=h/6RDsaSfheNozukK0Ceu7pW04yLOBO/Moo4k1hmSshoDvaN8vxD3GU8zSwHBhtIoR s5sEqAEF38/VW3rjR5xAdNXUx2oZk/pMpuc99+DBbYpb6cQPosaoxfRLrGV9HWAIjdxA NlnsIxCX9yJqu7hxmg12FXq5+nzhbKEjCSqiBpvklhl4/IqOIGQcjdVzdytIiE8UCnLa x2fOnurNAY4gzfFmiAm0fV/xYJ6VsfbhwrhHgvUTJZnzviuLYusAfsf0ZIXGO5TDEPjK iUquXcaGmLlg6ioDeCZIieQYseD+mk5SJJqtIaUxS5karMMf1PbuPIyYNyI9Tdg3zm0o Bwgg== 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:dkim-signature; bh=5m8wbQpRC/n2kDrtRQHX8CQtDPkqRrgeKqRq5/T/9OU=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=CWnql4Oo4hCkz5tz3De8xehb0IXRnTaHTP+KZupXwBXSX7gOyUFeWgCIrsjXhFu4rj AZEnzvvdF9KI1YTMgOeovjHn4Fn4wUoiUNmLX5vq7EJ+sZG6dRMO84lpqMToh5TjoRVh gIifi+SI2KdJAW9SjIZWS+fdJFgIldbHODEw4lQ324YjUWPeTZu8wc0ywJ45SZan++QO urtNFkWgd6qBT6QbeeotmiQ1V090oeTi6MxjdDN8Qey4oVt5H7vOnzdZ9VBVfWsve/ht rrianI17OqpkreGYztARj3heHFBbVEzXezv/HZrL6UIRFzwMA8y6MGwNSd82QS1/NyaG jNJQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b="C/ipRf0o"; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=kwKv4lLp; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=ipglpLYc; dkim=neutral (body hash did not verify) header.i=@lichtenheld.com header.s=MBO0001 header.b=dMo526h1; 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 Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 586e51a60fabf-4044bd783d6si13741024fac.210.2026.01.22.07.48.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Jan 2026 07:48:17 -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="C/ipRf0o"; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=kwKv4lLp; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=ipglpLYc; dkim=neutral (body hash did not verify) header.i=@lichtenheld.com header.s=MBO0001 header.b=dMo526h1; 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 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=5m8wbQpRC/n2kDrtRQHX8CQtDPkqRrgeKqRq5/T/9OU=; b=C/ipRf0otUioBnqH8KScek1kDN KyalhpX58ce6ANfseoecFOp0/2++7VhOWc5uBBjNSrEC2yuSmTSXWFrvgoARflExkO4H5PGBWYaMI 2+wl21PzfpNA5mEBmeZ25QEj5Qx+lvPOiSTxLPaTCtDnqtYa9zUksRU+MwiVkvi6Sk+s=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1viwuo-0002dK-Mc; Thu, 22 Jan 2026 15:48:10 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1viwul-0002d9-Mi for openvpn-devel@lists.sourceforge.net; Thu, 22 Jan 2026 15:48:08 +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=0t67M7r6ygtv8uIk/u4WrjaVCHBVQSpCVHzi42l+/lE=; b=kwKv4lLpkuwLRmUR/oqSD/nPTm Zm5AvcRyoFTVmhVyrk+G3lqFdPdYP01yRdjD13CzjOhAZYOUBlDPlGa9lxJdjMvs5cXPM1lpO4hOB o3YKFez4Yq7bDhmh4waM5fTdrCHPkv2gP0A2XMRXM5fh3WgtrLy7Rn07zbrvYYBAek4I=; 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=0t67M7r6ygtv8uIk/u4WrjaVCHBVQSpCVHzi42l+/lE=; b=ipglpLYc1y2JIYN6IUnbuBLQsS HsXbWWqNzbbfwJwMHsZN0gxT/kkWqJxG92rf7p7GEQjTkbAyjolduklLWTRzxnuvlxKhdjJaPa/BH 9VuxeYy63lfEtXYG+STITvPa0r8UKfbTc+MMMAFeaNHe5TJkauxQfbi083lnqGCfQkJ0=; Received: from mout-p-201.mailbox.org ([80.241.56.171]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1viwuk-000824-It for openvpn-devel@lists.sourceforge.net; Thu, 22 Jan 2026 15:48:07 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4dxlnh5jnnz9v0c for ; Thu, 22 Jan 2026 16:47:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lichtenheld.com; s=MBO0001; t=1769096872; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0t67M7r6ygtv8uIk/u4WrjaVCHBVQSpCVHzi42l+/lE=; b=dMo526h1ChTqkiS0BqUEZXqVxw1yFeBOZ7JeAadHyu4GnK/f3U/OPmUJDejYoWjxrTvJ/Y e8VvKsP09F/T5rQlN6eUdselZdTzDfDEuS6XqvUPvx45qQcIXU3Rck2Slc5n/VWnMa6dSW bf2PPB/jj7CxuN/GuKJyyReEOUk6W23th4oelTqnf92OnKBWllCRC3o+atiyj/1+lmmxRo DyguRLZ4AJIZwDBe07RBePFDHyTlWW22MO5rOW9Q5hBa6z00aXp9vebXf8V4epSGiFcpoP EonY46Hy5i8j1vYw+PBYAfIjXgnpfOihj71R74ASoY426lXjeWZKS4YBP/pS1g== From: Frank Lichtenheld To: openvpn-devel@lists.sourceforge.net Date: Thu, 22 Jan 2026 16:47:51 +0100 Message-ID: <20260122154751.155227-1-frank@lichtenheld.com> In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: -0.2 (/) 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: Just use explicit casts. len is limited by BCAP and c is limited by being from buf_read_u8. So they are safe. In case of status_printf this is only for Windows. len is limited by sizeof(buf), so also a safe cast. Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-Headers-End: 1viwuk-000824-It Subject: [Openvpn-devel] [PATCH v2] status: Avoid conversion warnings in status_read/status_printf 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?1855032548350481857?= X-GMAIL-MSGID: =?utf-8?q?1855032548350481857?= Just use explicit casts. len is limited by BCAP and c is limited by being from buf_read_u8. So they are safe. In case of status_printf this is only for Windows. len is limited by sizeof(buf), so also a safe cast. Change-Id: Iff1343a2f8cc7e32b8f36b359a00248e4dc3e8c9 Signed-off-by: Frank Lichtenheld Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1485 --- 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/+/1485 This mail reflects revision 2 of this Change. Acked-by according to Gerrit (reflected above): diff --git a/src/openvpn/status.c b/src/openvpn/status.c index 3f57244..d09f367 100644 --- a/src/openvpn/status.c +++ b/src/openvpn/status.c @@ -206,11 +206,6 @@ return ret; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - #define STATUS_PRINTF_MAXLEN 512 void @@ -243,7 +238,7 @@ size_t len = strlen(buf); if (len > 0) { - if (write(so->fd, buf, len) != len) + if (write(so->fd, buf, (unsigned int)len) != len) { so->errors = true; } @@ -274,16 +269,14 @@ /* read more of file into buffer */ if (c == -1) { - int len; - ASSERT(buf_init(&so->read_buf, 0)); - len = read(so->fd, BPTR(&so->read_buf), BCAP(&so->read_buf)); + ssize_t len = read(so->fd, BPTR(&so->read_buf), BCAP(&so->read_buf)); if (len <= 0) { break; } - ASSERT(buf_inc_len(&so->read_buf, len)); + ASSERT(buf_inc_len(&so->read_buf, (int)len)); continue; } @@ -299,7 +292,7 @@ break; } - buf_write_u8(buf, c); + buf_write_u8(buf, (uint8_t)c); } buf_null_terminate(buf); @@ -307,7 +300,3 @@ return ret; } - -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif