diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/string.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/string.h b/include/string.h index 10d071a..c1c24bc 100644 --- a/include/string.h +++ b/include/string.h | |||
| @@ -208,7 +208,9 @@ _FORTIFY_FN(stpncpy) char *stpncpy(char * _FORTIFY_POS0 __d, const char *__s, | |||
| 208 | #if __has_builtin(__builtin___stpncpy_chk) && FORTIFY_USE_NATIVE_CHK | 208 | #if __has_builtin(__builtin___stpncpy_chk) && FORTIFY_USE_NATIVE_CHK |
| 209 | return __builtin___stpncpy_chk(__d, __s, __n, __fh_bos(__d, 0)); | 209 | return __builtin___stpncpy_chk(__d, __s, __n, __fh_bos(__d, 0)); |
| 210 | #else | 210 | #else |
| 211 | __fh_size_t max_len_s = strnlen(__s, __n); | 211 | __fh_size_t max_len_s = strlen(__s); |
| 212 | if (max_len_s > __n) | ||
| 213 | max_len_s = __n; | ||
| 212 | if (__fh_overlap(__d, max_len_s, __s, max_len_s)) | 214 | if (__fh_overlap(__d, max_len_s, __s, max_len_s)) |
| 213 | __builtin_trap(); | 215 | __builtin_trap(); |
| 214 | 216 | ||
