pppoe: fix memcpy out of bounds with gcc-11 on arm 79/37779/2
authorTianyu Li <[email protected]>
Thu, 8 Dec 2022 02:08:32 +0000 (02:08 +0000)
committerDave Wallace <[email protected]>
Wed, 18 Jan 2023 00:47:36 +0000 (00:47 +0000)
commit531ac242a7ebd0e08393d2a0efa7a75703eaa456
tree9b1fcd0b952994b0b75c00733b581b6688d926f4
parent936b8ddcf7a00fe5b8863e10f4e4c8077975e94c
pppoe: fix memcpy out of bounds with gcc-11 on arm

In function ‘memcpy’,
    inlined from ‘clib_memcpy_fast’ at /home/vpp/src/vppinfra/string.h:86:10,
    inlined from ‘memcpy_s_inline’ at /home/vpp/src/vppinfra/string.h:157:7,
    inlined from ‘vnet_pppoe_add_del_session’ at /home/vpp/src/plugins/pppoe/pppoe.c:356:7:
 error: ‘__builtin_memcpy’ offset [0, 5] is out of the bounds [0, 0] [-Werror=array-bounds]
   34 |   return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cc1: all warnings being treated as errors

Hardware address is zero length vector for PPP, use vec_len instead.

Type: fix
Fixes: 62f9cdd82c52 ("Add PPPoE Plugin")
Signed-off-by: Tianyu Li <[email protected]>
Change-Id: If9fb409cfbbac77c15559d103987f0130bf30255
src/plugins/pppoe/pppoe.c