diff options
| author | jvoisin | 2024-10-21 15:04:50 +0200 |
|---|---|---|
| committer | jvoisin | 2024-10-21 15:04:50 +0200 |
| commit | dcdd2f1fb065b6e98d87ab7b367e8fb483f9b59c (patch) | |
| tree | f8902372c264e2e5d7f5540d6a57c78ec7277240 /include/string.h | |
| parent | e2cfd2879a15db00dfa9a42eeb1baaef6a930aff (diff) | |
Neuter an issue in strncat2.3.3
`strlen(src)` isn't guaranteed to be valid.
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 89bf25e..2e2b29c 100644 --- a/include/string.h +++ b/include/string.h | |||
| @@ -287,6 +287,7 @@ _FORTIFY_FN(strncat) char *strncat(char * _FORTIFY_POS0 __d, const char *__s, | |||
| 287 | #if __has_builtin(__builtin___strncat_chk) && FORTIFY_USE_NATIVE_CHK | 287 | #if __has_builtin(__builtin___strncat_chk) && FORTIFY_USE_NATIVE_CHK |
| 288 | return __builtin___strncat_chk(__d, __s, __n, __fh_bos(__d, 0)); | 288 | return __builtin___strncat_chk(__d, __s, __n, __fh_bos(__d, 0)); |
| 289 | #else | 289 | #else |
| 290 | #if 0 // strlen(__s) isn't guaranteed to be valid. | ||
| 290 | __fh_size_t __b = __fh_bos(__d, 0); | 291 | __fh_size_t __b = __fh_bos(__d, 0); |
| 291 | 292 | ||
| 292 | if (__n > __b) { | 293 | if (__n > __b) { |
| @@ -297,6 +298,7 @@ _FORTIFY_FN(strncat) char *strncat(char * _FORTIFY_POS0 __d, const char *__s, | |||
| 297 | if (__sl + __dl + 1 > __b) | 298 | if (__sl + __dl + 1 > __b) |
| 298 | __builtin_trap(); | 299 | __builtin_trap(); |
| 299 | } | 300 | } |
| 301 | #endif | ||
| 300 | return __orig_strncat(__d, __s, __n); | 302 | return __orig_strncat(__d, __s, __n); |
| 301 | #endif | 303 | #endif |
| 302 | } | 304 | } |
