[Openvpn-devel,v1] openvpnserv: fix log lines format string

Message ID 20260824180454.12181-1-gert@greenie.muc.de
State New
Headers
Series [Openvpn-devel,v1] openvpnserv: fix log lines format string |

Commit Message

Gert Doering Aug. 24, 2026, 6:04 p.m. UTC
  From: Heiko Hund <heiko@ist.eigentlich.net>

The interface name is UTF-8 encoded. In order to log it correctly,
it needs to be converted to UTF-16 first.

Change-Id: Iec392a47123d618c0dbc3a5241c39da4ac83d880
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Razvan Cojocaru <razvanc@mailbox.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1861
---

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

Acked-by according to Gerrit (reflected above):
Razvan Cojocaru <razvanc@mailbox.org>
  

Comments

Gert Doering Aug. 26, 2026, 6:56 a.m. UTC | #1
Interesting find.  On most systems this will never fire, as interfaces
tend to be "Ethernet 3" or "OpenVPN TAP Adapter" or such, with no
non-ASCII characters... and even then, if there is no error message,
it won't hit these branches either.

Test compiled on Ubuntu24.04/MinGW.

Your patch has been applied to the master and relase/2.7 branch (bugfix).

Release/2.6 does not have the InterfaceIdString() function, so whether or
not to backport the bugfix (given that we do not intend to do more
windows releases) is moot here :-)

commit 4f4b0771574e85787b15dd45a85a889ce66c16f9 (master)
commit 840db527fa2ce3823d70c54e72568f8e83bd5f9e (release/2.7)
Author: Heiko Hund
Date:   Mon Aug 24 20:04:48 2026 +0200

     openvpnserv: fix log lines format string

     Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
     Acked-by: Razvan Cojocaru <razvanc@mailbox.org>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1861
     Message-Id: <20260824180454.12181-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg38650.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering
  

Patch

diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c
index 32c1b9c..b120fa2 100644
--- a/src/openvpnserv/interactive.c
+++ b/src/openvpnserv/interactive.c
@@ -1224,19 +1224,25 @@ 
     err = InterfaceLuid(itf_name, &luid);
     if (err)
     {
-        MsgToEventLog(M_ERR, L"%S: failed to convert itf alias '%s'", __func__, itf_name);
+        PWSTR wide_name = utf8to16(itf_name);
+        MsgToEventLog(M_ERR, L"%S: failed to convert itf alias '%s'", __func__, wide_name);
+        free(wide_name);
         goto out;
     }
     err = ConvertInterfaceLuidToGuid(&luid, &guid);
     if (err)
     {
-        MsgToEventLog(M_ERR, L"%S: Failed to convert itf '%s' LUID", __func__, itf_name);
+        PWSTR wide_name = utf8to16(itf_name);
+        MsgToEventLog(M_ERR, L"%S: Failed to convert itf '%s' LUID", __func__, wide_name);
+        free(wide_name);
         goto out;
     }
 
     if (StringFromIID(&guid, &iid_str) != S_OK)
     {
-        MsgToEventLog(M_ERR, L"%S: Failed to convert itf '%s' IID", __func__, itf_name);
+        PWSTR wide_name = utf8to16(itf_name);
+        MsgToEventLog(M_ERR, L"%S: Failed to convert itf '%s' IID", __func__, wide_name);
+        free(wide_name);
         err = ERROR_OUTOFMEMORY;
         goto out;
     }