[Openvpn-devel,v1] proxy: Work-around spurious warning on mingw builds

Message ID 20260923130801.16802-1-gert@greenie.muc.de
State New
Headers
Series [Openvpn-devel,v1] proxy: Work-around spurious warning on mingw builds |

Commit Message

Gert Doering Sept. 23, 2026, 1:07 p.m. UTC
  From: Frank Lichtenheld <frank@lichtenheld.com>

mingw in Ubuntu 26.04 has issues with checking snprintf
format strings against original MS implementation even
though it uses the GCC implementation.

Apply work-around that is good enough for code that is
already gone in master.

Change-Id: If276bd4c5d07fcd26f6749f514f0257eab73249f
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1945
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to release/2.7.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1945
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Arne Schwabe <arne-openvpn@rfc2549.org>
  

Comments

Gert Doering Sept. 23, 2026, 1:25 p.m. UTC | #1
As discussed on IRC, this is not really changing anything, except 
"appease a confused compiler" (%zu actually works, just the mingw gcc
claims it doesn't).  The NTLM code is gone from master, so we do not
need the patch there - but we want to keep the GH Actions in sync, 
so we need to make 2.7 work with mingw-on-ubuntu26

Your patch has been applied to the release/2.7 branch.

commit 0c12762e6b250a967c154a2a127909e2bd9d3394 (release/2.7)
Author: Frank Lichtenheld
Date:   Wed Sep 23 15:07:56 2026 +0200

     proxy: Work-around spurious warning on mingw builds

     Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
     Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1945
     Message-Id: <20260923130801.16802-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg39441.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering
  

Patch

diff --git a/src/openvpn/proxy.c b/src/openvpn/proxy.c
index 7101d9f..857bf03 100644
--- a/src/openvpn/proxy.c
+++ b/src/openvpn/proxy.c
@@ -767,7 +767,9 @@ 
 
                 char get[80];
                 CLEAR(buf2);
-                snprintf(get, sizeof(get), "%%*s NTLM %%%zus", sizeof(buf2) - 1);
+                /* mingw checks calls to the builtin snprintf() with the
+                 * ms_printf archetype, which does not know the 'z' modifier */
+                snprintf(get, sizeof(get), "%%*s NTLM %%%us", (unsigned int)(sizeof(buf2) - 1));
                 nparms = sscanf(buf, get, buf2);
 
                 /* check for "Proxy-Authenticate: NTLM TlRM..." */