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 /tests | |
| 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 'tests')
| -rw-r--r-- | tests/test_stpncpy_static_write.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/test_stpncpy_static_write.c b/tests/test_stpncpy_static_write.c index 4bf9092..d4202ba 100644 --- a/tests/test_stpncpy_static_write.c +++ b/tests/test_stpncpy_static_write.c | |||
| @@ -4,7 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | int main(int argc, char** argv) { | 5 | int main(int argc, char** argv) { |
| 6 | char buffer[8] = {0}; | 6 | char buffer[8] = {0}; |
| 7 | stpncpy(buffer, "1234567", 5); | 7 | stpncpy(buffer, "1234567890", 5); |
| 8 | stpncpy(buffer, "1234567890", 8); | ||
| 8 | puts(buffer); | 9 | puts(buffer); |
| 9 | 10 | ||
| 10 | CHK_FAIL_START | 11 | CHK_FAIL_START |
