aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/test_valloc.c
diff options
context:
space:
mode:
authorSteven Luong <sluong@cisco.com>2021-11-03 15:33:21 -0700
committerDamjan Marion <dmarion@me.com>2021-11-05 19:20:10 +0000
commit51ddd38deb5866b10bbe9712ba6e8c4fb6da6381 (patch)
tree5a326543ec4cc0e4f8b72c19c0853303ada7bef4 /src/vppinfra/test_valloc.c
parent6259406668cee37d39ef3eb0b17ee5dc94ff02fe (diff)
unittest: gcc-11 errors for clib_strcpy, clib_strstr, clib_strcat, and clib_strncat
There are 3 versions of the string functions. For example, for strcpy, they are 1. strcpy(dst, src) -- the legacy unsafe version 2. strcpy_s(dst, dmax, src) -- C11 safeC version which has an addition argument named dmax. 3. clib_strcpy(dst,src) -- clib version to enable legacy code that uses strcpy to make use of strcpy_s without adding the additional argument, dmax, which is required by the C11 safeC version. The implementation for the clib version is to artificially provide dmax to strcpy_s. In this case, it uses 4096 which assumes that if the legacy code works without blowing up, it is likely to work with the clib version without problem. gcc-11 is getting smarter by checking if dmax is within the object's boundary. When the object is declared as static array, it will flag a warning/error if dmax is out of bound for the object since the real size of dst can be determined at compile time. There is no way to find the real size of dst if the object is dynamically allocated at compile time. For this reason, we simply can't provide support for the clib version of the function anymore. If any code is using the clib version, the choice is to migrate to the safeC version. Type: fix Fixes: b0598497afde60146fe8480331c9f96e7a79475a Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I99fa59c878331f995b734588cca3906a1d4782f5
Diffstat (limited to 'src/vppinfra/test_valloc.c')
0 files changed, 0 insertions, 0 deletions