summaryrefslogtreecommitdiffstats
path: root/src/plugins/pppoe/pppoe.c
diff options
context:
space:
mode:
authorTianyu Li <tianyu.li@arm.com>2022-12-08 02:08:32 +0000
committerDave Wallace <dwallacelf@gmail.com>2023-01-18 00:47:36 +0000
commit531ac242a7ebd0e08393d2a0efa7a75703eaa456 (patch)
tree9b1fcd0b952994b0b75c00733b581b6688d926f4 /src/plugins/pppoe/pppoe.c
parent936b8ddcf7a00fe5b8863e10f4e4c8077975e94c (diff)
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 <tianyu.li@arm.com> Change-Id: If9fb409cfbbac77c15559d103987f0130bf30255
Diffstat (limited to 'src/plugins/pppoe/pppoe.c')
-rw-r--r--src/plugins/pppoe/pppoe.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/pppoe/pppoe.c b/src/plugins/pppoe/pppoe.c
index 2bdbd3abed8..97adc2bd082 100644
--- a/src/plugins/pppoe/pppoe.c
+++ b/src/plugins/pppoe/pppoe.c
@@ -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;