From: "cron2 (Code Review)" Date: Tue, 20 May 2025 12:10:19 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., heiko@...515..., openvpn-devel@lists.sourceforge.net, frank@...2641..., lstipakov@...277... Message-ID: <289259bd5e384c378734ec408339a9a46766314b-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="bCj8CwIewWw="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: win: fix collecting DNS exclude data List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: d12fk Cc: stipa , plaisthos , flichtenheld , openvpn-devel --bCj8CwIewWw= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/10= 28?usp=3Demail ) Change subject: win: fix collecting DNS exclude data ...................................................................... win: fix collecting DNS exclude data The size of the returned MULTI_SZ wide domains string was calculated wrongly. Instead of adding the size of a WCHAR, only the size of a char was used. As a result, the domains string was stored too short and was missing the final string terminator. DHCP assigned DNS server addresses are separated by space, not comma. These spaces were not replaced by semicolon, as the spec requires. Github: fixes OpenVPN/openvpn#747 Change-Id: Ie3fcd845344fd0c3ce9a2f99612fb19fe5ebb2f1 Signed-off-by: Heiko Hund Acked-by: Lev Stipakov Message-Id: <20250520085513.28213-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31= 727.html Signed-off-by: Gert Doering --- M src/openvpnserv/interactive.c 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index a1581a6..6681b7c 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -2226,7 +2226,7 @@ { /* This was the last domain */ *pos =3D '\0'; - *size +=3D 1; + *size +=3D one_glyph; return wcslen(domains) ? NO_ERROR : ERROR_FILE_NOT= _FOUND; } } @@ -2248,13 +2248,13 @@ memmove(pos + 1, pos, buf_size - converted_size - one_glyp= h); domains[buf_len - 1] =3D '\0'; *pos =3D '.'; - *size +=3D 1; + *size +=3D one_glyph; if (!comma) { /* Conversion is done */ *(pos + domain_len) =3D '\0'; - *size +=3D 1; + *size +=3D one_glyph; return NO_ERROR; } @@ -2409,10 +2409,10 @@ if (v4_addrs_size || v6_addrs_size) { - /* Replace comma-delimters with semicolons, as required by NRP= T */ + /* Replace delimiters with semicolons, as required by NRPT */ for (int j =3D 0; j < sizeof(data[0].addresses) && data[i].add= resses[j]; j++) { - if (data[i].addresses[j] =3D=3D ',') + if (data[i].addresses[j] =3D=3D ',' || data[i].addresses[j= ] =3D=3D ' ') { data[i].addresses[j] =3D ';'; } -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1028?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ie3fcd845344fd0c3ce9a2f99612fb19fe5ebb2f1 Gerrit-Change-Number: 1028 Gerrit-PatchSet: 4 Gerrit-Owner: d12fk Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-Reviewer: stipa Gerrit-CC: openvpn-devel Gerrit-MessageType: merged --bCj8CwIewWw= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

win: fix collecting DNS exclude data

T= he size of the returned MULTI_SZ wide domains string was calculated
wron= gly. Instead of adding the size of a WCHAR, only the size of a char
was = used. As a result, the domains string was stored too short and was
missi= ng the final string terminator.

DHCP assigned DNS server addresses a= re separated by space, not comma.
These spaces were not replaced by semi= colon, as the spec requires.

Github: fixes OpenVPN/openvpn#747
Ch= ange-Id: Ie3fcd845344fd0c3ce9a2f99612fb19fe5ebb2f1
Signed-off-by: Heiko = Hund <heiko@...2662...>
Acked-by: Lev Stipakov <lstipakov@...1664...= 7...>
Message-Id: <20250520085513.28213-1-gert@...1296...>
U= RL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg317= 27.html
Signed-off-by: Gert Doering <gert@...1296...>
---
M = src/openvpnserv/interactive.c
1 file changed, 5 insertions(+), 5 deletio= ns(-)

diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive=
.c
index a1581a6..6681b7c 100644
--- a/src/= openvpnserv/interactive.c
+++ b/src/openvpnserv/interactive= .c
@@ -2226,7 +2226,7 @@
= {
/* This was the last domain *= /
*pos =3D '\0';- *size += =3D 1;
+ = *size +=3D one_glyph;
r= eturn wcslen(domains) ? NO_ERROR : ERROR_FILE_NOT_FOUND;
= }
}
@@ = -2248,13 +2248,13 @@
memmove(pos + 1, pos,= buf_size - converted_size - one_glyph);
d= omains[buf_len - 1] =3D '\0';
*pos= =3D '.';
- = *size +=3D 1;
+ *size +=3D one_glyph;

if (!comma)
{ /* Conversion is done */
= *(pos + domain_len) =3D '\0';
- *size +=3D 1;+ *size += =3D one_glyph;
return NO_ERROR;=
}

@@ -2409,10 = +2409,10 @@

if (v4_addrs_size ||= v6_addrs_size)
{
- /* Replace comma-delimters with semicolons= , as required by NRPT */
+ /* Replace delimiters with semicolons, as required by NRPT= */
for (int j =3D 0; j < sizeof(data[0].ad= dresses) && data[i].addresses[j]; j++)
= {
- if = (data[i].addresses[j] =3D=3D ',')
+ if (data[i].addresses[j] =3D=3D '= ,' || data[i].addresses[j] =3D=3D ' ')
= {
data[i].addresses[j] =3D &#= 39;;';
}

To view, visit change 1028. To unsubscribe, or for help writing mail fil= ters, visit settings.

=
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie3fcd845344fd0c3ce9a2f99612= fb19fe5ebb2f1
Gerrit-Change-Number: 1028
Gerrit-PatchSet: 4
Gerrit-Owner: d12fk <heiko@...515...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-Reviewer: stipa <lstipakov@...277...= >
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: merged
--bCj8CwIewWw=--