| Message ID | 20250324133759.13155-1-gert@greenie.muc.de |
|---|---|
| State | Accepted |
| Headers |
Return-Path: <openvpn-devel-bounces@lists.sourceforge.net>
Delivered-To: patchwork@openvpn.net
Received: by 2002:a05:7000:81e:b0:60a:d70a:d3c7 with SMTP id
jj30csp1892801mab;
Mon, 24 Mar 2025 06:38:33 -0700 (PDT)
X-Forwarded-Encrypted: i=2;
AJvYcCUiYlqG1BB+F9cm/ZoVTFpjiDHsOrmGZliywrdto4vR+2GhgwkMiLtJcitZH5UUDsMi9NmRBO7r+gc=@openvpn.net
X-Google-Smtp-Source:
AGHT+IETkreQ56tQwfxFPJCyKgB1raEHXn3O/BN8ETIAuqVbGrh0oDW2UcNOn3jo4U24dDekovmZ
X-Received: by 2002:a05:6e02:3305:b0:3d4:2acc:81fa with SMTP id
e9e14a558f8ab-3d595ec63acmr138850795ab.2.1742823512967;
Mon, 24 Mar 2025 06:38:32 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1742823512; cv=none;
d=google.com; s=arc-20240605;
b=SJ2E22GtqYxF5WO/s8ThddZge3MU+ImmPRwESsThhKCkIUKqtpJW/7o9bIImbDVEE+
xsf2j6x2d1FEn3Jpn7Dband85dR3pTLYHMgICoJ9xrVApILtx0/JSgeLuiVf5WR6hxXE
OvPAQweTLs+DKWZ2+UOgG2NPvogcP/qjNCcnF1qEBNkF/gcIEnuqheGG3U2JgAC7fqqk
pXvhZignYGX3tJf3n1gci5Cni1LKfHE5VzOAh4/pAyURCkrf182SOmK0MaQjodpRcldD
8Sw6EzpqXNm5nCZeonbA9/DRctB1vkNL5StyBKpFCTOfIxCrbXijbKWUvTDLFB+3BZcT
r2vA==
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;
bh=63GyheZm2huhwVt3XoXTQ7FUdcZ+OCbsE0RE2xBDNks=;
fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=;
b=AQIn0qfmYziMhtxZa+RTVvx1HQHYxINTG2lkcC67z2dvwTsWwJSDRbazbxnYbN2CK7
papa03SKcyIlpYX9Rb+0qNBWKDdJWPV5JljKahKLpgqzAO1VwB0oJF/qbIWB0lGmWHio
IBbVqAKOD0ebUJdRYpujX7wq0i2C6NNVjR7q8x20Cglzhg2aqRtBnbdQcHjC5ShOb7c/
b0GrPSftZbbT9u/LFaSImJxM5GCs5sDNplWzvEoPSOsQuv0Pyt5leDA2bn+NBodvwa08
xdlFaVDlltlZQmBIpCqTSyzLsvx8bEuwGKEdiLaEAUZclbPVrj3u8A74w7UvEoMNK5Cy
rfHw==;
dara=google.com
ARC-Authentication-Results: i=1; mx.google.com;
dkim=neutral (body hash did not verify) header.i=@sourceforge.net
header.s=x header.b=VlTtwati;
dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x
header.b=awue5zGk;
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
e9e14a558f8ab-3d596135060si87515885ab.117.2025.03.24.06.38.32
(version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
Mon, 24 Mar 2025 06:38:32 -0700 (PDT)
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=neutral (body hash did not verify) header.i=@sourceforge.net
header.s=x header.b=VlTtwati;
dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x
header.b=awue5zGk;
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 [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 <openvpn-devel-bounces@lists.sourceforge.net>)
id 1twi0a-0000Dx-Tl;
Mon, 24 Mar 2025 13:38:28 +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 <gert@blue.greenie.muc.de>) id 1twi0V-0000Dn-Cu
for openvpn-devel@lists.sourceforge.net;
Mon, 24 Mar 2025 13:38:22 +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=SU2QQsIwbAF6vwqnB0g/xaTKK1+U5v9S8AalS825xeQ=; b=VlTtwatiZQ5PNsVBZgtHt+Xq45
/iTJgqyisXbHyfcksn/pQXb7NBzLBgsC5y35GjB8g/ytyAB5IAgji1WrT2magEy8GiQkizflfwfm+
ZoU9wPAkL+9mQtT/+FONTp7YsNxdERhJJUFVQbvIJFXmiW9tvjI9EVR+4Hb1B4SgDYPc=;
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=SU2QQsIwbAF6vwqnB0g/xaTKK1+U5v9S8AalS825xeQ=; b=awue5zGkYdkfSL0Ec4tyYkeVYO
mGfDxWfbcnSdF8jCPprYHTaDoL0+75ZjCoQ9AnLv487pTvSiPG7bmHtp5Hs/Cbu7xK7Ox4HJRw04A
vJriMIYIrEV6OGR/0y7BMqnlYmxM8sJMMCI59MuHelzRrPeM5Sx9p8UtI0jdOGb+rO80=;
Received: from dhcp-174.greenie.muc.de ([193.149.48.174]
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 1twi0J-0005tN-KS for openvpn-devel@lists.sourceforge.net;
Mon, 24 Mar 2025 13:38:22 +0000
Received: from blue.greenie.muc.de (localhost [127.0.0.1])
by blue.greenie.muc.de (8.17.1.9/8.17.1.9) with ESMTP id 52ODc0nq013255
for <openvpn-devel@lists.sourceforge.net>; Mon, 24 Mar 2025 14:38:00 +0100
Received: (from gert@localhost)
by blue.greenie.muc.de (8.17.1.9/8.17.1.9/Submit) id 52ODc0kt013254
for openvpn-devel@lists.sourceforge.net; Mon, 24 Mar 2025 14:38:00 +0100
From: Gert Doering <gert@greenie.muc.de>
To: openvpn-devel@lists.sourceforge.net
Date: Mon, 24 Mar 2025 14:37:53 +0100
Message-ID: <20250324133759.13155-1-gert@greenie.muc.de>
X-Mailer: git-send-email 2.45.2
In-Reply-To:
<gerrit.1742822307000.Ib579c1538eb5440bb7008bc866a5cb7d74844374@gerrit.openvpn.net>
References:
<gerrit.1742822307000.Ib579c1538eb5440bb7008bc866a5cb7d74844374@gerrit.openvpn.net>
MIME-Version: 1.0
X-Spam-Score: 0.0 (/)
X-Spam-Report: Spam detection software,
running on the system "util-spamd-2.v13.lw.sourceforge.com",
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: Arne Schwabe <arne@rfc2549.org> This fixes the build
failures on MSVC cl compiler. MSVC cl does not thinks of the expression of
a const variable times an integer to be compile time static. C23 introduce
the constexpr (like in C++) statement for that but we are only on C11 for
now. Content analysis details: (0.0 points, 6.0 required)
pts rule name description
---- ----------------------
--------------------------------------------------
0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The
query to Validity was blocked. See
https://knowledge.validity.com/hc/en-us/articles/20961730681243
for more information.
[193.149.48.174 listed in sa-trusted.bondedsender.org]
0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The
query to Validity was blocked. See
https://knowledge.validity.com/hc/en-us/articles/20961730681243
for more information.
[193.149.48.174 listed in bl.score.senderscore.com]
-0.0 SPF_PASS SPF: sender matches SPF record
-0.0 SPF_HELO_PASS SPF: HELO matches SPF record
X-Headers-End: 1twi0J-0005tN-KS
Subject: [Openvpn-devel] [PATCH v2] Directly use _countof in array
initialisation
X-BeenThere: openvpn-devel@lists.sourceforge.net
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: <openvpn-devel.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/options/openvpn-devel>,
<mailto:openvpn-devel-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive:
<http://sourceforge.net/mailarchive/forum.php?forum_name=openvpn-devel>
List-Post: <mailto:openvpn-devel@lists.sourceforge.net>
List-Help: <mailto:openvpn-devel-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/openvpn-devel>,
<mailto:openvpn-devel-request@lists.sourceforge.net?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: openvpn-devel-bounces@lists.sourceforge.net
X-getmail-retrieved-from-mailbox: Inbox
X-GMAIL-THRID: =?utf-8?q?1827482907644507830?=
X-GMAIL-MSGID: =?utf-8?q?1827482907644507830?=
|
| Series |
[Openvpn-devel,v2] Directly use _countof in array initialisation
|
|
Commit Message
Gert Doering
March 24, 2025, 1:37 p.m. UTC
From: Arne Schwabe <arne@rfc2549.org> This fixes the build failures on MSVC cl compiler. MSVC cl does not thinks of the expression of a const variable times an integer to be compile time static. C23 introduce the constexpr (like in C++) statement for that but we are only on C11 for now. So directly use the _countof(msg->addr) expression in the array initialisation. Change-Id: Ib579c1538eb5440bb7008bc866a5cb7d74844374 Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Frank Lichtenheld <frank@lichtenheld.com> --- 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/+/915 This mail reflects revision 2 of this Change. Acked-by according to Gerrit (reflected above): Frank Lichtenheld <frank@lichtenheld.com>
Comments
Thanks. Back to old-style const expressions, then...
Your patch has been applied to the master branch.
commit 1fc44d3b2ad3b96405650754a6e43f1576cda132
Author: Arne Schwabe
Date: Mon Mar 24 14:37:53 2025 +0100
Directly use _countof in array initialisation
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20250324133759.13155-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31205.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
--
kind regards,
Gert Doering
diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index e64ac30..c6963b3 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -1901,7 +1901,9 @@ if (msg->addr_len > 0) { /* prepare the comma separated address list */ - CHAR addrs[max_addrs * 64]; /* 64 is enough for one IPv4/6 address */ + /* cannot use max_addrs here as that is not considered compile + * time constant by all compilers and constexpr is C23 */ + CHAR addrs[_countof(msg->addr) * 64]; /* 64 is enough for one IPv4/6 address */ size_t offset = 0; for (int i = 0; i < addr_len; ++i) {