aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2026-06-02 13:12:36 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2026-06-02 13:12:36 -0400
commitb608580042590bf73d60789943e5efa134d6a2fd (patch)
tree08618ef55a061146a583970636312f3d5bfdd64a
parenta9c8746a324e820d3452e44a67e6cab502fd58b5 (diff)
downloadstasis-b608580042590bf73d60789943e5efa134d6a2fd.tar.gz
Replace string functions
-rw-r--r--tests/test_utils.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/tests/test_utils.c b/tests/test_utils.c
index 696e7ff..fc53f53 100644
--- a/tests/test_utils.c
+++ b/tests/test_utils.c
@@ -313,8 +313,7 @@ void test_path_dirname() {
const char *input = data[i];
const char *expected = data[i + 1];
char tmp[PATH_MAX] = {0};
- strncpy(tmp, input, sizeof(tmp) - 1);
- tmp[sizeof(tmp) - 1] = '\0';
+ safe_strncpy(tmp, input, sizeof(tmp));
char *result = path_dirname(tmp);
STASIS_ASSERT(strcmp(expected, result) == 0, NULL);
@@ -349,8 +348,8 @@ void test_expandpath() {
STASIS_ASSERT_FATAL(home != NULL, "cannot expand without knowing the user's home directory path");
char path[PATH_MAX] = {0};
- strncat(path, "~", sizeof(path) - strlen(path) - 1);
- strncat(path, DIR_SEP, sizeof(path) - strlen(path) - 1);
+ safe_strncat(path, "~", sizeof(path));
+ safe_strncat(path, DIR_SEP, sizeof(path));
char *expanded = expandpath(path);
STASIS_ASSERT(startswith(expanded, home) > 0, expanded);