From: Frank Lichtenheld Date: Sun, 31 Aug 2025 15:12:52 +0000 (+0200) Subject: socket_util: Clean up conversion warnings in add_in6_addr X-Git-Tag: v2.7_beta1~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=84ef4848e7c7325759c67a1bfee231e13efe9f89;p=thirdparty%2Fopenvpn.git socket_util: Clean up conversion warnings in add_in6_addr Change-Id: Id3b8719ee6b457ce2d85156b39e0cea771a97e74 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Message-Id: <20250831151259.25788-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32725.html Signed-off-by: Gert Doering --- diff --git a/src/openvpn/socket_util.c b/src/openvpn/socket_util.c index 13f8c3223..9b7312d19 100644 --- a/src/openvpn/socket_util.c +++ b/src/openvpn/socket_util.c @@ -241,14 +241,12 @@ print_in_port_t(in_port_t port, struct gc_arena *gc) struct in6_addr add_in6_addr(struct in6_addr base, uint32_t add) { - int i; - - for (i = 15; i >= 0 && add > 0; i--) + for (int i = 15; i >= 0 && add > 0; i--) { - register int carry; + register uint32_t carry; register uint32_t h; - h = (unsigned char)base.s6_addr[i]; + h = base.s6_addr[i]; base.s6_addr[i] = (h + add) & UINT8_MAX; /* using explicit carry for the 8-bit additions will catch