On 1/2/2019 8:12 AM, Honggang Li wrote: > The sizeof(port->vlarb_high) is 128. sizeof(default_vlarb_high) is 30. > > memcpy(port->vlarb_high, default_vlarb_high, sizeof(port->vlarb_high)) > will fill [31, 128] bytes of port->vlarb_high with garbage after > default_vlarb_high. > > ------------------------------------------------------------------------- > make[1]: Entering directory '/home/honli/rpmbuild/BUILD/ibsim-0.7/ibsim' > cc -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wall -g -Werror -Wno-deprecated-declarations -fpic -I. -I../include -I/usr/include -c -o sim_net.o sim_net.c > In file included from /usr/include/string.h:494, > from sim_net.c:38: > In function 'memcpy', > inlined from 'init_ports' at sim_net.c:648:3: > /usr/include/bits/string_fortified.h:34:10: error: '__builtin_memcpy' forming offset [31, 128] is out of the bounds [0, 30] of object 'default_vlarb_high' with type 'const struct vlarb[15]' [-Werror=array-bounds] > return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > sim_net.c: In function 'init_ports': > sim_net.c:171:27: note: 'default_vlarb_high' declared here > static const struct vlarb default_vlarb_high[] = { > ^~~~~~~~~~~~~~~~~~ > In file included from /usr/include/string.h:494, > from sim_net.c:38: > In function 'memcpy', > inlined from 'init_ports' at sim_net.c:650:3: > /usr/include/bits/string_fortified.h:34:10: error: '__builtin_memcpy' forming offset [31, 128] is out of the bounds [0, 30] of object 'default_vlarb_low' with type 'const struct vlarb[15]' [-Werror=array-bounds] > return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > sim_net.c: In function 'init_ports': > sim_net.c:176:27: note: 'default_vlarb_low' declared here > static const struct vlarb default_vlarb_low[] = { > ^~~~~~~~~~~~~~~~~ > In file included from /usr/include/string.h:494, > from sim_net.c:38: > > Signed-off-by: Honggang Li <honli@xxxxxxxxxx> Thanks. Applied. -- Hal