diff options
author | Lijian Zhang <Lijian.Zhang@arm.com> | 2018-08-28 10:18:24 +0800 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-08-30 10:18:38 +0000 |
commit | ec2a9bbb89a4ec1ebf8982f1d611179cd84315b8 (patch) | |
tree | 7cc688d17dd392d679655522581159fb53a01836 | |
parent | be460e72d5d87e4272f4663d9c3edcdc147e70b6 (diff) |
Fix array bound failure in api_sr_localsid_add_del
When compiling VPP with GCC-8.2.0, it gives below error messages.
src/vat/api_format.c: In function ‘api_sr_localsid_add_del’:
src/vat/api_format.c:10839:7: error: ‘memcpy’ forming offset [5, 16] is out of the bounds [0, 4] of object ‘nh_addr4’ with type ‘ip4_address_t’ {aka ‘union <anonymous>’} [-Werror=array-bounds]
clib_memcpy (mp->nh_addr6, &nh_addr4, sizeof (mp->nh_addr6));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/vat/api_format.c:10809:17: note: ‘nh_addr4’ declared here
ip4_address_t nh_addr4;
^~~~~~~~
Change-Id: I9065a3407d53c1f91974b32381972c4edb45144c
Signed-off-by: Lijian Zhang <Lijian.Zhang@arm.com>
-rw-r--r-- | src/vat/api_format.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c index 321127aa41d..43b7d5307cc 100644 --- a/src/vat/api_format.c +++ b/src/vat/api_format.c @@ -10836,8 +10836,8 @@ api_sr_localsid_add_del (vat_main_t * vam) clib_memcpy (mp->localsid.addr, &localsid, sizeof (mp->localsid)); if (nexthop_set) { - clib_memcpy (mp->nh_addr6, &nh_addr4, sizeof (mp->nh_addr6)); - clib_memcpy (mp->nh_addr4, &nh_addr6, sizeof (mp->nh_addr4)); + clib_memcpy (mp->nh_addr6, &nh_addr6, sizeof (mp->nh_addr6)); + clib_memcpy (mp->nh_addr4, &nh_addr4, sizeof (mp->nh_addr4)); } mp->behavior = behavior; mp->sw_if_index = ntohl (sw_if_index); |