From: "cron2 (Code Review)" Date: Mon, 15 Dec 2025 15:55:13 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <48cc315fc252b92ae18811cf4da0a67887cac78d-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="eXrO/qQweHM="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: manage: Avoid several conversion warnings by using the correct types List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld , plaisthos Cc: openvpn-devel --eXrO/qQweHM= 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= flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1438?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: manage: Avoid several conversion warnings by using the corr= ect types ...................................................................... manage: Avoid several conversion warnings by using the correct types Change-Id: I0c5ef13d6fa6c1dd15da934a33e904c2fdacb731 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1438 Message-Id: <20251215152355.20654-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35= 077.html Signed-off-by: Gert Doering --- M src/openvpn/manage.c 1 file changed, 10 insertions(+), 26 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/38/1438/2 diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index 6efa100..2191e55 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -206,11 +206,6 @@ return man->settings.up.defined && !man->connection.password_verified; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - static void man_check_password(struct management *man, const char *line) { @@ -220,7 +215,8 @@ * the attacker choice, it should not give any indication of the r= eal * password length, use + 1 to include the NUL byte that terminate= s the * string*/ - size_t compare_len =3D min_uint(strlen(line) + 1, sizeof(man->sett= ings.up.password)); + size_t compare_len =3D + min_size(strlen(line) + 1, sizeof(man->settings.up.password)); if (memcmp_constant_time(line, man->settings.up.password, compare_= len) =3D=3D 0) { man->connection.password_verified =3D true; @@ -241,10 +237,6 @@ } } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - static void man_update_io_state(struct management *man) { @@ -2315,19 +2307,14 @@ #endif /* ifdef TARGET_ANDROID */ -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - -static int +static ssize_t man_read(struct management *man) { /* * read command line from socket */ unsigned char buf[256]; - int len =3D 0; + ssize_t len =3D 0; #ifdef TARGET_ANDROID int fd; @@ -2348,7 +2335,7 @@ { bool processed_command =3D false; - ASSERT(len <=3D (int)sizeof(buf)); + ASSERT(len <=3D (ssize_t)sizeof(buf)); command_line_add(man->connection.in, buf, (size_t)len); /* @@ -2414,11 +2401,11 @@ return len; } -static int +static ssize_t man_write(struct management *man) { const int size_hint =3D 1024; - int sent =3D 0; + ssize_t sent =3D 0; const struct buffer *buf; buffer_list_aggregate(man->connection.out, size_hint); @@ -2435,7 +2422,9 @@ } else #endif + { sent =3D send(man->connection.sd_cli, (const void *)BPTR(buf),= len, MSG_NOSIGNAL); + } if (sent >=3D 0) { buffer_list_advance(man->connection.out, sent); @@ -2457,10 +2446,6 @@ return sent; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - static void man_connection_clear(struct man_connection *mc) { @@ -3222,8 +3207,7 @@ if (net_events & FD_WRITE) { - int status; - status =3D man_write(man); + ssize_t status =3D man_write(man); if (status < 0 && WSAGetLastError() =3D=3D WSAEWOULDBL= OCK) { net_event_win32_clear_selected_events(&man->connec= tion.ne32, FD_WRITE); -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1438?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: I0c5ef13d6fa6c1dd15da934a33e904c2fdacb731 Gerrit-Change-Number: 1438 Gerrit-PatchSet: 2 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --eXrO/qQweHM= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 upl= oaded patch set #2 to the change originally created by flichtenhel= d.

View Change

The following approvals got outdated and were remove= d: Code-Review+2 by cron2

manage: Avoid several conversion wa=
rnings by using the correct types

Change-Id: I0c5ef13d6fa6c1dd15da93= 4a33e904c2fdacb731
Signed-off-by: Frank Lichtenheld <frank@...2641...= >
Acked-by: Gert Doering <gert@...1296...>
Gerrit URL: https= ://gerrit.openvpn.net/c/openvpn/+/1438
Message-Id: <20251215152355.20= 654-1-gert@...1296...>
URL: https://www.mail-archive.com/openvpn-deve= l@lists.sourceforge.net/msg35077.html
Signed-off-by: Gert Doering <ge= rt@...1296...>
---
M src/openvpn/manage.c
1 file changed, 10 in= sertions(+), 26 deletions(-)

git pull ssh://gerr=
it.openvpn.net:29418/openvpn refs/changes/38/1438/2
diff --git a/sr=
c/openvpn/manage.c b/src/openvpn/manage.c
index 6efa100..21= 91e55 100644
--- a/src/openvpn/manage.c
+++= b/src/openvpn/manage.c
@@ -206,11 +206,6 @@
return man->settings.up.defined && !man->connection.pa= ssword_verified;
}

-#if defined(__GNUC__) || defined(__clang__)=
-#pragma GCC diagnosti= c push
-#pragma GCC dia= gnostic ignored "-Wconversion"
-#endif
-
static void
man_check_password(struc= t management *man, const char *line)
{
@@ = -220,7 +215,8 @@
* the attacker choice, it should= not give any indication of the real
* password l= ength, use + 1 to include the NUL byte that terminates the
= * string*/
- = size_t compare_len =3D min_uint(strlen(line) + 1, sizeof(man->set= tings.up.password));
= + size_t compare_len =3D
+ min_size(strlen(line) + 1, sizeof(man->settings.= up.password));
if (memcmp_constant_time(line, man-= >settings.up.password, compare_len) =3D=3D 0)
{=
man->connection.password_verified =3D true= ;
@@ -241,10 +237,6 @@
}
}

-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
static void
man_update_io_= state(struct management *man)
{
@@ -2315,1= 9 +2307,14 @@

#endif /* ifdef TARGET_AND= ROID */

-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconv= ersion"
-#endif
-
-static int
+static ssize_t
man_read(struct mana= gement *man)
{
/*
= * read command line from socket
*/
unsigned char buf[256];

- int len =3D 0;
+ ssize_t len =3D 0;

#ifdef TAR= GET_ANDROID
int fd;
@@ -2348,7 +2335,7= @@
{
bool processed_command = =3D false;

- ASSERT(len <=3D (int)sizeof(buf));
+ ASSERT(len <=3D (ssize_t)sizeo= f(buf));
command_line_add(man->connection.in, b= uf, (size_t)len);

/*
<= span>@@ -2414,11 +2401,11 @@
return len;
}

-static int
+static = ssize_t
man_write(struct management *man)
= {
const int size_hint =3D 1024;
- int sent =3D 0;
+ ssize_t sent =3D 0;
= const struct buffer *buf;

buffer= _list_aggregate(man->connection.out, size_hint);
@@ -243= 5,7 +2422,9 @@
}
else

#endif
= + {
sent =3D send(man->connection.sd= _cli, (const void *)BPTR(buf), len, MSG_NOSIGNAL);
+ }
if (sent = >=3D 0)
{
buffer_l= ist_advance(man->connection.out, sent);
@@ -2457,10 +244= 6,6 @@
return sent;
}

-#if defined(__GNUC_= _) || defined(__clang__)
-#endif
-=
static void
man_connection_clear(struct man_con= nection *mc)
{
@@ -3222,8 +3207,7 @@


if (net_events & FD_WRITE= )
{
- int status;
- status =3D man_write(man);

+ ssi= ze_t status =3D man_write(man);
if (st= atus < 0 && WSAGetLastError() =3D=3D WSAEWOULDBLOCK)
<= span> {
net_ev= ent_win32_clear_selected_events(&man->connection.ne32, FD_WRITE);

To view, visit change 1438. To unsubscribe, o= r for help writing mail filters, visit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0c5ef13d6fa6c1dd15da934a33e= 904c2fdacb731
Gerrit-Change-Number: 1438
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --eXrO/qQweHM=--