summaryrefslogtreecommitdiffhomepage
path: root/libs/luci-lib-ip/src/ip.c
diff options
context:
space:
mode:
authorSantiago Piccinini <spiccinini@altermundi.net>2020-09-06 18:15:29 -0300
committerSantiago Piccinini <spiccinini@altermundi.net>2020-09-06 18:15:29 -0300
commit62505bdd2d25f4e2538904938160495515b8bbf9 (patch)
treeeb04feabdb19f302730ee9f86a3a760f4950c886 /libs/luci-lib-ip/src/ip.c
parent809d085adab8921a7d72f6b1e2900b3347e357ff (diff)
luci-lib-ip: fix tolinklocal invalid ipv6 result
Force zeroing uninitialized memory. Signed-off-by: Santiago Piccinini <spiccinini@altermundi.net>
Diffstat (limited to 'libs/luci-lib-ip/src/ip.c')
-rw-r--r--libs/luci-lib-ip/src/ip.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libs/luci-lib-ip/src/ip.c b/libs/luci-lib-ip/src/ip.c
index 10d11a365b..9b157da265 100644
--- a/libs/luci-lib-ip/src/ip.c
+++ b/libs/luci-lib-ip/src/ip.c
@@ -837,6 +837,12 @@ static int cidr_tolinklocal(lua_State *L)
p2->bits = AF_BITS(AF_INET6);
p2->addr.u8[0] = 0xFE;
p2->addr.u8[1] = 0x80;
+ p2->addr.u8[2] = 0x00;
+ p2->addr.u8[3] = 0x00;
+ p2->addr.u8[4] = 0x00;
+ p2->addr.u8[5] = 0x00;
+ p2->addr.u8[6] = 0x00;
+ p2->addr.u8[7] = 0x00;
p2->addr.u8[8] = p1->addr.u8[0] ^ 0x02;
p2->addr.u8[9] = p1->addr.u8[1];
p2->addr.u8[10] = p1->addr.u8[2];