diff options
| author | jvoisin | 2026-04-30 17:37:02 +0200 |
|---|---|---|
| committer | jvoisin | 2026-04-30 17:37:02 +0200 |
| commit | 6040b4a27409968c764353a98c45d972cfd89a8a (patch) | |
| tree | c19298f18faa782b0a20805b193c5ec8a28327e7 /include | |
| parent | b9121e4d679b5fccb69abcb58b05a6be5c7191dc (diff) | |
Fix a bug in stpncpy
The manpage says that stpncpy will "copy non-null bytes from the string pointed
to by src into the array pointed to by dst.", it doesn't add a terminal NULL
byte, so we shouldn't check for it.
Diffstat (limited to 'include')
| -rw-r--r-- | include/string.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/string.h b/include/string.h index 7987d17..23f598c 100644 --- a/include/string.h +++ b/include/string.h | |||
| @@ -104,7 +104,7 @@ _FORTIFY_FN(stpncpy) char *stpncpy(char * _FORTIFY_POS0 __d, const char *__s, | |||
| 104 | { | 104 | { |
| 105 | size_t __b = __bos(__d, 0); | 105 | size_t __b = __bos(__d, 0); |
| 106 | 106 | ||
| 107 | if (__n > __b && strlen(__s) + 1 > __b) | 107 | if (__n > __b) |
| 108 | __builtin_trap(); | 108 | __builtin_trap(); |
| 109 | return __orig_stpncpy(__d, __s, __n); | 109 | return __orig_stpncpy(__d, __s, __n); |
| 110 | } | 110 | } |
