Change in openvpn[master]: manage: Avoid several conversion warnings by using the correct types
A message that is not in the archive (sent off-list or not yet received): gerrit.1765538409000.I0c5ef13d6fa6c1dd15da934a33e904c2fdacb731@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1438?usp=email
to review the following change.
Change subject: manage: Avoid several conversion warnings by using the correct types
......................................................................
manage: Avoid several conversion warnings by using the correct types
---
M src/openvpn/manage.c
1 file changed, 10 insertions(+), 26 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/38/1438/1
src/openvpn/manage.c +10 -26
@@ -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 real * password length, use + 1 to include the NUL byte that terminates the * string*/ -size_t compare_len =min_uint (strlen (line) +1 ,sizeof (man->settings.up.password)); +size_t compare_len = +min_size (strlen (line) +1 ,sizeof (man->settings.up.password));if (memcmp_constant_time (line, man->settings.up.password, compare_len) ==0 ) { man->connection.password_verified = 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 =0 ; +ssize_t len =0 ;#ifdef TARGET_ANDROID int fd;
@@ -2348,7 +2335,7 @@ {bool processed_command = false; -ASSERT (len <= (int )sizeof (buf)); +ASSERT (len <= (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 =1024 ; -int sent =0 ; +ssize_t sent =0 ;const struct buffer *buf;buffer_list_aggregate (man->connection.out, size_hint);
@@ -2435,7 +2422,9 @@ } else#endif + { sent =send (man->connection.sd_cli, (const void *)BPTR (buf), len,MSG_NOSIGNAL ); + }if (sent >=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 =man_write (man); +ssize_t status =man_write (man);if (status <0 &&WSAGetLastError () ==WSAEWOULDBLOCK ) {net_event_win32_clear_selected_events (&man->connection.ne32,FD_WRITE );
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1438?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0c5ef13d6fa6c1dd15da934a33e904c2fdacb731
Gerrit-Change-Number: 1438
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1438?usp=email )
Change subject: manage: Avoid several conversion warnings by using the correct types
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1438?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0c5ef13d6fa6c1dd15da934a33e904c2fdacb731
Gerrit-Change-Number: 1438
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 15 Dec 2025 15:23:42 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
PATCH 1/1 manage: Avoid several conversion warnings by using the correct types
In reply to a message not in the archiveFrom: Frank Lichtenheld <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1438
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1438
This mail reflects revision 1 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
src/openvpn/manage.c +10 -26
@@ -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 real * password length, use + 1 to include the NUL byte that terminates the * string*/ -size_t compare_len =min_uint (strlen (line) +1 ,sizeof (man->settings.up.password)); +size_t compare_len = +min_size (strlen (line) +1 ,sizeof (man->settings.up.password));if (memcmp_constant_time (line, man->settings.up.password, compare_len) ==0 ) { man->connection.password_verified = 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 =0 ; +ssize_t len =0 ;#ifdef TARGET_ANDROID int fd;
@@ -2348,7 +2335,7 @@ {bool processed_command = false; -ASSERT (len <= (int )sizeof (buf)); +ASSERT (len <= (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 =1024 ; -int sent =0 ; +ssize_t sent =0 ;const struct buffer *buf;buffer_list_aggregate (man->connection.out, size_hint);
@@ -2435,7 +2422,9 @@ } else#endif + { sent =send (man->connection.sd_cli, (const void *)BPTR (buf), len,MSG_NOSIGNAL ); + }if (sent >=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 =man_write (man); +ssize_t status =man_write (man);if (status <0 &&WSAGetLastError () ==WSAEWOULDBLOCK ) {net_event_win32_clear_selected_events (&man->connection.ne32,FD_WRITE );
[Openvpn-devel] [PATCH applied] Re: manage: Avoid several conversion warnings by using the correct types
Looks reasonable, BB is happy, another #pragma gone!
Your patch has been applied to the master branch.
commit a4b51e68ff8c7d8d31ca630fd050e86b82a9a832
Author: Frank Lichtenheld Date: Mon Dec 15 16:23:50 2025 +0100
manage: Avoid several conversion warnings by using the correct types
Signed-off-by: Frank Lichtenheld <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1438
Message-Id: <[email protected]...>
URL:; https://www.mail-archive.com/[email protected]/msg35077.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#2) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1438?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: manage: Avoid several conversion warnings by using the correct types
......................................................................
manage: Avoid several conversion warnings by using the correct types
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1438
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35077.html
---
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
src/openvpn/manage.c +10 -26
@@ -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 real * password length, use + 1 to include the NUL byte that terminates the * string*/ -size_t compare_len =min_uint (strlen (line) +1 ,sizeof (man->settings.up.password)); +size_t compare_len = +min_size (strlen (line) +1 ,sizeof (man->settings.up.password));if (memcmp_constant_time (line, man->settings.up.password, compare_len) ==0 ) { man->connection.password_verified = 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 =0 ; +ssize_t len =0 ;#ifdef TARGET_ANDROID int fd;
@@ -2348,7 +2335,7 @@ {bool processed_command = false; -ASSERT (len <= (int )sizeof (buf)); +ASSERT (len <= (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 =1024 ; -int sent =0 ; +ssize_t sent =0 ;const struct buffer *buf;buffer_list_aggregate (man->connection.out, size_hint);
@@ -2435,7 +2422,9 @@ } else#endif + { sent =send (man->connection.sd_cli, (const void *)BPTR (buf), len,MSG_NOSIGNAL ); + }if (sent >=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 =man_write (man); +ssize_t status =man_write (man);if (status <0 &&WSAGetLastError () ==WSAEWOULDBLOCK ) {net_event_win32_clear_selected_events (&man->connection.ne32,FD_WRITE );
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1438?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0c5ef13d6fa6c1dd15da934a33e904c2fdacb731
Gerrit-Change-Number: 1438
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1438?usp=email )
Change subject: manage: Avoid several conversion warnings by using the correct types
......................................................................
manage: Avoid several conversion warnings by using the correct types
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1438
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35077.html
---
M src/openvpn/manage.c
1 file changed, 10 insertions(+), 26 deletions(-)
src/openvpn/manage.c +10 -26
@@ -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 real * password length, use + 1 to include the NUL byte that terminates the * string*/ -size_t compare_len =min_uint (strlen (line) +1 ,sizeof (man->settings.up.password)); +size_t compare_len = +min_size (strlen (line) +1 ,sizeof (man->settings.up.password));if (memcmp_constant_time (line, man->settings.up.password, compare_len) ==0 ) { man->connection.password_verified = 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 =0 ; +ssize_t len =0 ;#ifdef TARGET_ANDROID int fd;
@@ -2348,7 +2335,7 @@ {bool processed_command = false; -ASSERT (len <= (int )sizeof (buf)); +ASSERT (len <= (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 =1024 ; -int sent =0 ; +ssize_t sent =0 ;const struct buffer *buf;buffer_list_aggregate (man->connection.out, size_hint);
@@ -2435,7 +2422,9 @@ } else#endif + { sent =send (man->connection.sd_cli, (const void *)BPTR (buf), len,MSG_NOSIGNAL ); + }if (sent >=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 =man_write (man); +ssize_t status =man_write (man);if (status <0 &&WSAGetLastError () ==WSAEWOULDBLOCK ) {net_event_win32_clear_selected_events (&man->connection.ne32,FD_WRITE );
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1438?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I0c5ef13d6fa6c1dd15da934a33e904c2fdacb731
Gerrit-Change-Number: 1438
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>