[Openvpn-devel,v1] Fix some msg() calls with wrong number of arguments in Windows-only code

Message ID 20260508153108.13488-1-gert@greenie.muc.de
State New
Headers
Series [Openvpn-devel,v1] Fix some msg() calls with wrong number of arguments in Windows-only code |

Commit Message

Gert Doering May 8, 2026, 3:31 p.m. UTC
  From: Frank Lichtenheld <frank@lichtenheld.com>

For some reason neither MSVC nor MinGW complained?
cppcheck did (once told that msg is a printf-style
function).

Change-Id: Ia688ec12e642de699811ced8668b40be9fbb6155
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1672
---

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/+/1672
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <gert@greenie.muc.de>
  

Comments

Gert Doering May 11, 2026, 12:10 p.m. UTC | #1
Impressive find.  Bug :-) - have not tried to figure out how to get
these messages printed (it's in the error handlers, so quite likely
"never, for most users").  Still, obviously correct fix.

Test compiled on mingw/ubuntu.

Your patch has been applied to the master and release/2.7 branch (bug).

commit af44c0f8929bc9817a11ac149ae01f3589959325 (master)
commit 815a3bd87d61b57d640551386efce9638aa014a0 (release/2.7)
Author: Frank Lichtenheld
Date:   Fri May 8 17:31:02 2026 +0200

     Fix some msg() calls with wrong number of arguments in Windows-only code

     Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1672
     Message-Id: <20260508153108.13488-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36862.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering
  

Patch

diff --git a/src/openvpnmsica/msiex.c b/src/openvpnmsica/msiex.c
index f8bf6ae..4d48f06 100644
--- a/src/openvpnmsica/msiex.c
+++ b/src/openvpnmsica/msiex.c
@@ -51,7 +51,7 @@ 
         *pszValue = (LPWSTR)malloc(++dwLength * sizeof(WCHAR));
         if (*pszValue == NULL)
         {
-            msg(M_FATAL, "%s: malloc(%u) failed", dwLength * sizeof(WCHAR));
+            msg(M_FATAL, "%s: malloc(%u) failed", __FUNCTION__, dwLength * sizeof(WCHAR));
             return ERROR_OUTOFMEMORY;
         }
 
diff --git a/src/tapctl/tap.c b/src/tapctl/tap.c
index 6ed395d..cccc0e1 100644
--- a/src/tapctl/tap.c
+++ b/src/tapctl/tap.c
@@ -487,8 +487,8 @@ 
         }
 
         default:
-            msg(M_NONFATAL, "%s: \"%ls\" registry value is not string (type %u)", __FUNCTION__,
-                dwValueType);
+            msg(M_NONFATAL, "%s: \"%ls\" registry value is not string (type %u)",
+                __FUNCTION__, szName, dwValueType);
             return ERROR_UNSUPPORTED_TYPE;
     }
 }