From: Arne Schwabe <a...@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 <a...@rfc2549.org> Acked-by: Frank Lichtenheld <fr...@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 <fr...@lichtenheld.com> 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) { _______________________________________________ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel