From: "cron2 (Code Review)"
Date: Thu, 30 Oct 2025 21:14:37 +0000
In-Reply-To:
References:
Reply-To: gert@...1296..., arne-openvpn@...1227..., heiko@...515...,
openvpn-devel@lists.sourceforge.net, frank@...2641...
Message-ID: <9a2c6cc54a27b21b59ce8c2f8632c4e37681fc14-EmailReplacePatchSet-HTML@...2715...>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Content-Type: multipart/alternative; boundary="KFTldIwUva4="; charset=UTF-8
Subject: [Openvpn-devel] [XS] Change in openvpn[master]: iservice: check
return value of MultiByteToWideChar
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
To: d12fk , plaisthos , flichtenheld
Cc: openvpn-devel
--KFTldIwUva4=
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
cron2 has uploaded a new patch set (#2) to the change originally created by=
d12fk. ( http://gerrit.openvpn.net/c/openvpn/+/1306?usp=3Demail )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: iservice: check return value of MultiByteToWideChar
......................................................................
iservice: check return value of MultiByteToWideChar
If the first call to MultiByteToWideChar returns 0, something must have
failed, because it returns the required buffer size including the
terminating zero. When it does return 0, just return NULL and indicate
that the call to utf8to16(_size) failed.
Found by ZeroPath.
Reported-By: Joshua Rogers
Change-Id: I92804da010bab36cd0326759c04f955f2bda74de
Signed-off-by: Heiko Hund
Acked-by: Gert Doering
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1306
Message-Id: <20251030194736.2151-1-gert@...1296...>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34=
071.html
Signed-off-by: Gert Doering
---
M src/openvpnserv/common.c
1 file changed, 4 insertions(+), 0 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/06/1306/2
diff --git a/src/openvpnserv/common.c b/src/openvpnserv/common.c
index e975cc7..d25d9c0 100644
--- a/src/openvpnserv/common.c
+++ b/src/openvpnserv/common.c
@@ -276,6 +276,10 @@
utf8to16_size(const char *utf8, int size)
{
int n =3D MultiByteToWideChar(CP_UTF8, 0, utf8, size, NULL, 0);
+ if (n =3D=3D 0)
+ {
+ return NULL;
+ }
wchar_t *utf16 =3D malloc(n * sizeof(wchar_t));
if (!utf16)
{
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1306?usp=3Demail
To unsubscribe, or for help writing mail filters, visit http://gerrit.openv=
pn.net/settings?usp=3Demail
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I92804da010bab36cd0326759c04f955f2bda74de
Gerrit-Change-Number: 1306
Gerrit-PatchSet: 2
Gerrit-Owner: d12fk
Gerrit-Reviewer: cron2
Gerrit-Reviewer: flichtenheld
Gerrit-Reviewer: plaisthos
Gerrit-CC: openvpn-devel
--KFTldIwUva4=
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
cron2 upl=
oaded patch set #2 to the change originally created by d12fk.
<=
p>View C=
hange
The following approvals got outdated and were removed:
Code-Review+2 by cron2
iservice: check return value of Mul=
tiByteToWideChar
If the first call to MultiByteToWideChar returns 0,=
something must have
failed, because it returns the required buffer size=
including the
terminating zero. When it does return 0, just return NULL=
and indicate
that the call to utf8to16(_size) failed.
Found by Z=
eroPath.
Reported-By: Joshua Rogers <contact@...2949...>
Ch=
ange-Id: I92804da010bab36cd0326759c04f955f2bda74de
Signed-off-by: Heiko =
Hund <heiko@...2662...>
Acked-by: Gert Doering <gert@...1296...=
>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1306
Message-=
Id: <20251030194736.2151-1-gert@...1296...>
URL: https://www.mail-=
archive.com/openvpn-devel@lists.sourceforge.net/msg34071.html
Signed-off=
-by: Gert Doering <gert@...1296...>
---
M src/openvpnserv/commo=
n.c
1 file changed, 4 insertions(+), 0 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/06/1306=
/2
diff --git a/src/openvpnserv/common.c b/src/openvpnserv/common.c=
index e975cc7..d25d9c0 100644
--- a/src/op=
envpnserv/common.c
+++ b/src/openvpnserv/common.c
@@ -276,6 +276,10 @@
utf8to16_size(const char *utf8=
, int size)
{
int n =3D MultiByteToWi=
deChar(CP_UTF8, 0, utf8, size, NULL, 0);
+ if (n =3D=3D 0)
+ {
+ return NULL;
+ }
wchar_t *utf16 =3D malloc(n * sizeof(wch=
ar_t));
if (!utf16)
{
<=
span>
To view, visit change 1306. To unsubscribe, or for hel=
p writing mail filters, visit settings.
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I92804da010bab36cd0326759c04=
f955f2bda74de
Gerrit-Change-Number: 1306
Gerrit-PatchSet: 2
Gerrit-Owner: d12fk <heiko@...515...> =
div>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...=
1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...=
.1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...=
ts.sourceforge.net>
=
--KFTldIwUva4=--