diff options
| author | jvoisin | 2026-05-01 00:36:32 +0200 |
|---|---|---|
| committer | jvoisin | 2026-05-01 00:44:53 +0200 |
| commit | ddd22b2f533db9c0da0bb262fbafa51f67c8587e (patch) | |
| tree | d319dab03de20929f95ccf7f9bec8c428ab6a66b /tests/Makefile | |
| parent | d6105aba5fd791e8d3f069e771517cdb947b5604 (diff) | |
Fix strncat/wcsncat
Previously, no checks were done when __n <= __b, but strncat _appends_ after
existing content, making this a overly broad check check. For example, with an
8-byte buffer containing "12345\0", strncat(buf, "ABCD", 4) would have the
check skipped, but the result "12345ABCD\0" is 10 bytes, resulting in an
overflow.
This commit fixes this oversight, and adds a bunch of tests.
Diffstat (limited to '')
| -rw-r--r-- | tests/Makefile | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/Makefile b/tests/Makefile index 6904b2d..9bedd16 100644 --- a/tests/Makefile +++ b/tests/Makefile | |||
| @@ -84,6 +84,11 @@ RUNTIME_TARGETS= \ | |||
| 84 | test_strlcpy_dynamic_write \ | 84 | test_strlcpy_dynamic_write \ |
| 85 | test_strlcpy_static_write \ | 85 | test_strlcpy_static_write \ |
| 86 | test_strncat_dynamic_write \ | 86 | test_strncat_dynamic_write \ |
| 87 | test_strncat_n_eq_buf \ | ||
| 88 | test_strncat_n_gt_buf \ | ||
| 89 | test_strncat_n_lt_buf \ | ||
| 90 | test_strncat_n_one \ | ||
| 91 | test_strncat_safe \ | ||
| 87 | test_strncat_static_write \ | 92 | test_strncat_static_write \ |
| 88 | test_strncpy_dynamic_write \ | 93 | test_strncpy_dynamic_write \ |
| 89 | test_strncpy_static_write \ | 94 | test_strncpy_static_write \ |
| @@ -101,6 +106,11 @@ RUNTIME_TARGETS= \ | |||
| 101 | test_wcsnrtombs_static \ | 106 | test_wcsnrtombs_static \ |
| 102 | test_wcscat_static_write \ | 107 | test_wcscat_static_write \ |
| 103 | test_wcscpy_static_write \ | 108 | test_wcscpy_static_write \ |
| 109 | test_wcsncat_n_eq_buf \ | ||
| 110 | test_wcsncat_n_gt_buf \ | ||
| 111 | test_wcsncat_n_lt_buf \ | ||
| 112 | test_wcsncat_n_one \ | ||
| 113 | test_wcsncat_safe \ | ||
| 104 | test_wcsncat_static_write \ | 114 | test_wcsncat_static_write \ |
| 105 | test_wcsncpy_static_write \ | 115 | test_wcsncpy_static_write \ |
| 106 | test_wmemcpy_dynamic_read \ | 116 | test_wmemcpy_dynamic_read \ |
