| Message ID | 20251122155506.8901-1-gert@greenie.muc.de |
|---|---|
| State | New |
| Headers | show |
| Series | [Openvpn-devel,v2] iservice: fix buffer size in call to FormatMessage | expand |
I have not actually tested this (beyond "does it compile") but reading
the docs about FormatMessageW() and the overall other code, this looks
very correct.
Your patch has been applied to the master branch.
It might be applicable to release/2.6, but we use a "TCHAR" there, not
a WCHAR - so that code might just be correct, or not.
commit b39bed539f218f6165d79224adbc343a63a4514d
Author: Heiko Hund
Date: Sat Nov 22 16:55:00 2025 +0100
iservice: fix buffer size in call to FormatMessage
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1387
Message-Id: <20251122155506.8901-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34583.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 33282c63..f64c247 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -734,9 +734,8 @@ err_str = L"Unknown Win32 Error"; - if (FormatMessage(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM - | FORMAT_MESSAGE_ARGUMENT_ARRAY, - NULL, err, 0, buf, sizeof(buf), NULL)) + if (FormatMessageW(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, err, 0, buf, _countof(buf), NULL)) { err_str = buf; }