From: "cron2 (Code Review)" Date: Mon, 15 Dec 2025 15:55:16 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <48cc315fc252b92ae18811cf4da0a67887cac78d-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="Bat4dxBdhxw="; 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 Cc: plaisthos , openvpn-devel --Bat4dxBdhxw= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/14= 38?usp=3Demail ) 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(-) 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; } =20 -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: merged 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 --Bat4dxBdhxw= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 sub= mitted this change.

View Change

manage: Avoid several conversion warnings by usi=
ng the correct types

Change-Id: I0c5ef13d6fa6c1dd15da934a33e904c2fda= cb731
Signed-off-by: Frank Lichtenheld <frank@...2641...>
Acked= -by: Gert Doering <gert@...1296...>
Gerrit URL: https://gerrit.ope= nvpn.net/c/openvpn/+/1438
Message-Id: <20251215152355.20654-1-gert@...1186...= .1296...>
URL: https://www.mail-archive.com/openvpn-devel@...1011...= eforge.net/msg35077.html
Signed-off-by: Gert Doering <gert@...1296...= >
---
M src/openvpn/manage.c
1 file changed, 10 insertions(+), = 26 deletions(-)

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__)
-#pr= agma GCC diagnostic push
-#endif
-
static void
man_ch= eck_password(struct management *man, const char *line)
{
@@ -220,7 +215,8 @@
* the attacker= choice, it should not give any indication of the real
= * password length, use + 1 to include the NUL byte that terminates th= e
* string*/
- size_t compare_len =3D min_uint(strlen(line) + 1, = sizeof(man->settings.up.password));
+ size_t compare_len =3D
+ min_size(strlen(line) + 1, sizeof= (man->settings.up.password));
if (memcmp_consta= nt_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__)
<= span style=3D"color: hsl(0, 100%, 40%);">-#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 ig= nored "-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;

<= span> #ifdef TARGET_ANDROID

int fd;
@@= -2348,7 +2335,7 @@
{
bool pr= ocessed_command =3D false;

- ASSERT(len <=3D (int)sizeof(buf));=
+ ASSERT(len <=3D= (ssize_t)sizeof(buf));
command_line_add(man->c= onnection.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);
<= span style=3D"color: hsl(120, 100%, 40%);">+ }

= if (sent >=3D 0)
{
= buffer_list_advance(man->connection.out, sent);
@@ = -2457,10 +2446,6 @@
return sent;
}

-#if de= fined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
static void
man_connection_clear(s= truct man_connection *mc)
{
@@ -3222,8 +32= 07,7 @@

if (net_events &= amp; FD_WRITE)
{
- int status;
- status =3D man_wr= ite(man);

+ = ssize_t status =3D man_write(man);
= if (status < 0 && WSAGetLastError() =3D=3D WSAEWOULDBLOCK= )
{
= net_event_win32_clear_selected_events(&man->connection.ne32, = FD_WRITE);

To view, visit change 1438. To u= nsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
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>
= --Bat4dxBdhxw=--