diff options
| author | jvoisin | 2025-10-28 23:18:21 +0100 |
|---|---|---|
| committer | jvoisin | 2025-10-28 23:18:21 +0100 |
| commit | ede3643ed290bc6b7764d6add93e76899f7629b2 (patch) | |
| tree | 77ba643f80d4348efbd680268f5d227432c848f8 /include/string.h | |
| parent | 05baf9cfe90c25b02652489c6dd75810600ead5e (diff) | |
Add a missing FORTIFY_PEDANTIC_CHECKSexperimental
Fixing the following issue:
```
In file included from xstrndup.c:34:
/OpenWrt/aarch64/staging_dir/toolchain-aarch64_cortex-a53_gcc-14.3.0_musl/include/fortify/string.h: In function 'mempcpy':
/OpenWrt/aarch64/staging_dir/toolchain-aarch64_cortex-a53_gcc-14.3.0_musl/include/fortify/string.h:340:13: error: 'nonnull' argument '__d' compared to NULL [-Werror=nonnull-compare]
340 | if (!__d || !__s)
| ^~~~
/OpenWrt/aarch64/staging_dir/toolchain-aarch64_cortex-a53_gcc-14.3.0_musl/include/fortify/string.h:340:21: error: 'nonnull' argument '__s' compared to NULL [-Werror=nonnull-compare]
340 | if (!__d || !__s)
| ^~~~
cc1: all warnings being treated as errors
make[5]: *** [Makefile:511: xstrndup.o] Error 1
```
Reported in https://github.com/openwrt/openwrt/pull/20552
Diffstat (limited to 'include/string.h')
| -rw-r--r-- | include/string.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/string.h b/include/string.h index 7a8564a..98ec292 100644 --- a/include/string.h +++ b/include/string.h | |||
| @@ -344,8 +344,10 @@ _FORTIFY_FN(mempcpy) void *mempcpy(void * _FORTIFY_POS0 __d, | |||
| 344 | #if __has_builtin(__builtin___mempcpy_chk) && defined(FORTIFY_USE_NATIVE_CHK) | 344 | #if __has_builtin(__builtin___mempcpy_chk) && defined(FORTIFY_USE_NATIVE_CHK) |
| 345 | return __builtin___mempcpy_chk(__d, __s, __n, __fh_bos(__d, 0)); | 345 | return __builtin___mempcpy_chk(__d, __s, __n, __fh_bos(__d, 0)); |
| 346 | #else | 346 | #else |
| 347 | #if defined FORTIFY_PEDANTIC_CHECKS | ||
| 347 | if (!__d || !__s) | 348 | if (!__d || !__s) |
| 348 | __builtin_trap(); | 349 | __builtin_trap(); |
| 350 | #endif | ||
| 349 | 351 | ||
| 350 | __fh_size_t __bd = __fh_bos(__d, 0); | 352 | __fh_size_t __bd = __fh_bos(__d, 0); |
| 351 | __fh_size_t __bs = __fh_bos(__s, 0); | 353 | __fh_size_t __bs = __fh_bos(__s, 0); |
