Fix error: 'memset' forming offset [16, 27] is out of the bounds [0, 16] of object 'inaddr' with type 'union <anonymous>'

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-03-05 21:56:12 +08:00 committed by Abdelatif Guettouche
parent 3afd1234e0
commit d4290b3e93

View File

@ -327,7 +327,7 @@ int cmd_addroute(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
* /128 -> ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
*/
memset(&inaddr.ipv6, 0, sizeof(struct sockaddr_in6));
memset(&inaddr.ipv6, 0, sizeof(inaddr.ipv6));
for (i = 0; i < 8 && shift >= 16; i++, shift -= 16)
{
inaddr.ipv6.s6_addr16[i] = 0xffff;