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: 62f9cdd82c ("Add PPPoE Plugin")
Signed-off-by: Tianyu Li <tianyu.li@arm.com>
Change-Id: If9fb409cfbbac77c15559d103987f0130bf30255
This commit is contained in:
@@ -353,7 +353,7 @@ int vnet_pppoe_add_del_session
|
||||
pool_get_aligned (pem->sessions, t, CLIB_CACHE_LINE_BYTES);
|
||||
clib_memset (t, 0, sizeof (*t));
|
||||
|
||||
clib_memcpy (t->local_mac, hi->hw_address, 6);
|
||||
clib_memcpy (t->local_mac, hi->hw_address, vec_len (hi->hw_address));
|
||||
|
||||
/* copy from arg structure */
|
||||
#define _(x) t->x = a->x;
|
||||
|
||||
Reference in New Issue
Block a user