From: "flichtenheld (Code Review)" Date: Fri, 19 Dec 2025 14:32:15 +0000 References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: <84d294bc571131f05a9e11d0aa5869c05f10a810-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="kXDYoBrIdxI="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: ssl_ncp: Avoid conversion warning in replace_default_in_ncp_ciphers_o... List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --kXDYoBrIdxI= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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/+/1452?usp=3Demail to review the following change. Change subject: ssl_ncp: Avoid conversion warning in replace_default_in_ncp= _ciphers_option ...................................................................... ssl_ncp: Avoid conversion warning in replace_default_in_ncp_ciphers_option Change-Id: I380e842b7429060d13bc0264e55fa5c06ab427df Signed-off-by: Frank Lichtenheld --- M src/openvpn/ssl_ncp.c 1 file changed, 3 insertions(+), 11 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/52/1452/1 diff --git a/src/openvpn/ssl_ncp.c b/src/openvpn/ssl_ncp.c index d4519b0..06262fe 100644 --- a/src/openvpn/ssl_ncp.c +++ b/src/openvpn/ssl_ncp.c @@ -534,11 +534,6 @@ } } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - /** * Replaces the string DEFAULT with the string \c replace. * @@ -549,12 +544,13 @@ replace_default_in_ncp_ciphers_option(struct options *o, const char *repla= ce) { const char *search =3D "DEFAULT"; - const int ncp_ciphers_len =3D strlen(o->ncp_ciphers) + strlen(replace)= - strlen(search) + 1; + const size_t ncp_ciphers_len =3D strlen(o->ncp_ciphers) + strlen(repla= ce) - strlen(search) + 1; uint8_t *ncp_ciphers =3D gc_malloc(ncp_ciphers_len, true, &o->gc); struct buffer ncp_ciphers_buf; - buf_set_write(&ncp_ciphers_buf, ncp_ciphers, ncp_ciphers_len); + ASSERT(ncp_ciphers_len <=3D INT_MAX); + buf_set_write(&ncp_ciphers_buf, ncp_ciphers, (int)ncp_ciphers_len); const char *def =3D strstr(o->ncp_ciphers, search); @@ -571,10 +567,6 @@ o->ncp_ciphers =3D (char *)ncp_ciphers; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - /** * Checks for availibility of Chacha20-Poly1305 and sets * the ncp_cipher to either AES-256-GCM:AES-128-GCM or -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1452?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newchange Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I380e842b7429060d13bc0264e55fa5c06ab427df Gerrit-Change-Number: 1452 Gerrit-PatchSet: 1 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos --kXDYoBrIdxI= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: plaisthos.

flichtenheld would like plaisthos to review this change.

V= iew Change

ssl_ncp: Avoid conversion warning in replac=
e_default_in_ncp_ciphers_option

Change-Id: I380e842b7429060d13bc0264= e55fa5c06ab427df
Signed-off-by: Frank Lichtenheld <frank@...2641...&g= t;
---
M src/openvpn/ssl_ncp.c
1 file changed, 3 insertions(+), 11= deletions(-)

git pull ssh://gerrit.openvpn.net:=
29418/openvpn refs/changes/52/1452/1
diff --git a/src/openvpn/ssl_n=
cp.c b/src/openvpn/ssl_ncp.c
index d4519b0..06262fe 100644<= /span>
--- a/src/openvpn/ssl_ncp.c
+++ b/src/openv= pn/ssl_ncp.c
@@ -534,11 +534,6 @@
}
}

-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored &qu= ot;-Wconversion"

-= #endif
-
/**

* Replaces the string DEFAULT with the string \c r= eplace.
*
@@ -549,12 +544,13 @@ replace_default_in_ncp_ciphers_option(struct options *o, const char= *replace)
{
const char *search =3D &= quot;DEFAULT";
- = const int ncp_ciphers_len =3D strlen(o->ncp_ciphers) + strlen(replace)= - strlen(search) + 1;
- buf_set_write(&ncp_cipher= s_buf, ncp_ciphers, ncp_ciphers_len);
+ ASSERT(ncp_ciphers_len <=3D INT_MAX);
+ buf_set_write(&ncp_ciphe= rs_buf, ncp_ciphers, (int)ncp_ciphers_len);

const char *def =3D strstr(o->ncp_ciphers, search);

@@ -571,10 +567,6 @@
o->ncp_c= iphers =3D (char *)ncp_ciphers;
}
=
-#if defined(__GNUC__) || def= ined(__clang__)
-#pragm= a GCC diagnostic pop
-#= endif
-
/**
* Checks for availibility of Chacha20-Poly1305 and = sets
* the ncp_cipher to either AES-256-GCM:AES-128-GCM o= r

To view, visit change 1452. To unsubscrib= e, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I380e842b7429060d13bc0264e55= fa5c06ab427df
Gerrit-Change-Number: 1452
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
= --kXDYoBrIdxI=--