| Message ID | 20260122125829.108470-1-frank@lichtenheld.com |
|---|---|
| State | New |
| Headers | show |
| Series | [Openvpn-devel,v1] ssl_ncp: Avoid conversion warning in replace_default_in_ncp_ciphers_option | expand |
Change makes sense, has an ACK from Arne (who authored most of this code),
and passes BB tests. One #pragma pair gone, in it goes :-)
Your patch has been applied to the master branch.
commit b28321edfe65290fae6d09d931aa36187ad95e95
Author: Frank Lichtenheld
Date: Thu Jan 22 13:58:28 2026 +0100
ssl_ncp: Avoid conversion warning in replace_default_in_ncp_ciphers_option
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1452
Message-Id: <20260122125829.108470-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35391.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
--
kind regards,
Gert Doering
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 *replace) { const char *search = "DEFAULT"; - const int ncp_ciphers_len = strlen(o->ncp_ciphers) + strlen(replace) - strlen(search) + 1; + const size_t ncp_ciphers_len = strlen(o->ncp_ciphers) + strlen(replace) - strlen(search) + 1; uint8_t *ncp_ciphers = 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 <= INT_MAX); + buf_set_write(&ncp_ciphers_buf, ncp_ciphers, (int)ncp_ciphers_len); const char *def = strstr(o->ncp_ciphers, search); @@ -571,10 +567,6 @@ o->ncp_ciphers = (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