mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-04 00:00:14 -04:00
traffic-selector: Add workaround for possibly bogus warning with GCC 14
When compiling with -O3 with GCC 14, we get the following warning/error: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:29:10: error: '__builtin_memcpy' offset [0, 3] is out of the bounds [0, 0] [-Werror=array-bounds=] 29 | return __builtin___memcpy_chk (__dest, __src, __len, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 30 | __glibc_objsize0 (__dest)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ Which seems completely bogus as that array has a fixed size of 16 and some weird workarounds remove the warning (e.g. adding an assignment to `subset->netbits` before the `memcpy()`). This is also the only place GCC complains about and we use `memcpy()` all over the place in this file to set those addresses. Closes strongswan/strongswan#2509
This commit is contained in:
parent
b2210f446e
commit
f462e4b9ee
@ -428,8 +428,8 @@ METHOD(traffic_selector_t, get_subset, traffic_selector_t*,
|
||||
|
||||
/* we have a match in protocol, port, and address: return it... */
|
||||
subset = traffic_selector_create(protocol, this->type, from_port, to_port);
|
||||
memcpy(subset->from, from, size);
|
||||
memcpy(subset->to, to, size);
|
||||
memcpy(subset->from, from, sizeof(subset->from));
|
||||
memcpy(subset->to, to, sizeof(subset->to));
|
||||
calc_netbits(subset);
|
||||
|
||||
return &subset->public;
|
||||
|
Loading…
x
Reference in New Issue
Block a user