| Message ID | 20250831151259.25788-1-gert@greenie.muc.de |
|---|---|
| State | Accepted |
| Headers | show |
| Series | [Openvpn-devel,v4] socket_util: Clean up conversion warnings in add_in6_addr | expand |
The patch itself is straight forward, but having a unit test for all
the possible overflows is very welcome - "it will test itself, across
all platforms". BB is all green, local test on Linux also passes.
Your patch has been applied to the master branch.
commit 84ef4848e7c7325759c67a1bfee231e13efe9f89
Author: Frank Lichtenheld
Date: Sun Aug 31 17:12:52 2025 +0200
socket_util: Clean up conversion warnings in add_in6_addr
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
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 <gert@greenie.muc.de>
--
kind regards,
Gert Doering
diff --git a/src/openvpn/socket_util.c b/src/openvpn/socket_util.c index 13f8c32..9b7312d 100644 --- a/src/openvpn/socket_util.c +++ b/src/openvpn/socket_util.c @@ -241,14 +241,12 @@ 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