summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Donald2025-11-17 03:18:26 +0000
committerÁlvaro Fernández Rojas2025-11-18 07:18:57 +0000
commitaf9968c0293fd2ca81edfc29575decb006cd73fc (patch)
tree7e4b0c61b26ea092c60d9bf20e7adf3321f4bc81
parent5492f09ec07514cf8543bc06c34556e24b590852 (diff)
downloadodhcp6c-af9968c0293fd2ca81edfc29575decb006cd73fc.tar.gz
dhcpv6: fix processing PIO exclusion loop variable collision
An inner loop variable i potentially collides with the outer loop i, possibly giving unexpected results. Commit b146f9adc80c introduced both the inner and outer loop. Fixes: b146f9adc80c ("add support for multiple prefixes with distinct IAIDs") Signed-off-by: Paul Donald <newtwen+github@gmail.com> Link: https://github.com/openwrt/odhcp6c/pull/124 Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
-rw-r--r--src/dhcpv6.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/dhcpv6.c b/src/dhcpv6.c
index 872f169..68c04f4 100644
--- a/src/dhcpv6.c
+++ b/src/dhcpv6.c
@@ -816,8 +816,9 @@ static void dhcpv6_send(enum dhcpv6_msg type, uint8_t trid[3], uint32_t ecs)
excl >>= (64 - e[j].priority);
excl <<= 8 - ((e[j].priority - e[j].length) % 8);
- for (size_t i = ex_len - 5; i > 0; --i, excl >>= 8)
- ia_pd[ia_pd_len + i] = excl & 0xff;
+ for (size_t k = ex_len - 5; k > 0; --k, excl >>= 8)
+ ia_pd[ia_pd_len + k] = excl & 0xff;
+
ia_pd_len += ex_len - 5;
}