From: Arne Schwabe Date: Thu, 30 Oct 2025 19:38:20 +0000 (+0100) Subject: Fix warnings about conversion from int to unsigned char/uint8_t X-Git-Tag: v2.7_rc1~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e7df832354fd476defe6a0fb35ab1aa05314c5e3;p=thirdparty%2Fopenvpn.git Fix warnings about conversion from int to unsigned char/uint8_t When compiling with cmake -DCMAKE_BUILD_TYPE=ASAN under Ubuntu 25.10 (gcc 15.2.0). Explicitly cast these instances to uint8_t/unssigned char to silence this warning. Change-Id: I648ee99b1152b1248d1b3e64af7679ab99f1388f Signed-off-by: Arne Schwabe Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1328 Message-Id: <20251030193834.1186-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34065.html Signed-off-by: Gert Doering --- diff --git a/src/openvpn/httpdigest.c b/src/openvpn/httpdigest.c index be2063853..3e6520a38 100644 --- a/src/openvpn/httpdigest.c +++ b/src/openvpn/httpdigest.c @@ -46,7 +46,7 @@ CvtHex(IN HASH Bin, OUT HASHHEX Hex) } else { - Hex[i * 2] = (j + 'a' - 10); + Hex[i * 2] = (unsigned char)(j + 'a' - 10); } j = Bin[i] & 0xf; if (j <= 9) @@ -55,7 +55,7 @@ CvtHex(IN HASH Bin, OUT HASHHEX Hex) } else { - Hex[i * 2 + 1] = (j + 'a' - 10); + Hex[i * 2 + 1] = (unsigned char)(j + 'a' - 10); } } Hex[HASHHEXLEN] = '\0'; diff --git a/src/openvpn/mroute.c b/src/openvpn/mroute.c index b50d48f20..d17902f06 100644 --- a/src/openvpn/mroute.c +++ b/src/openvpn/mroute.c @@ -337,7 +337,7 @@ mroute_addr_mask_host_bits(struct mroute_addr *ma) } else { - ma->v6.addr.s6_addr[byte--] &= (0xFF << bits_to_clear); + ma->v6.addr.s6_addr[byte--] &= (uint8_t)(0xFF << bits_to_clear); bits_to_clear = 0; } }