From 096441a470af4b9255aa1696daadad214907132f Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 2 Jun 2026 13:10:15 -0400 Subject: Replace string functions --- src/lib/core/strlist.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/lib/core/strlist.c b/src/lib/core/strlist.c index 5cd3f4a..60f3a1f 100644 --- a/src/lib/core/strlist.c +++ b/src/lib/core/strlist.c @@ -88,8 +88,7 @@ int strlist_append_file(struct StrList *pStrList, char *_path, ReaderFn *readerF if (is_url) { int fd; char tempfile[PATH_MAX] = {0}; - strncpy(tempfile, "/tmp/.remote_file.XXXXXX", sizeof(tempfile) - 1); - tempfile[sizeof(tempfile) - 1] = '\0'; + safe_strncpy(tempfile, "/tmp/.remote_file.XXXXXX", sizeof(tempfile)); if ((fd = mkstemp(tempfile)) < 0) { retval = -1; @@ -449,8 +448,7 @@ void strlist_set(struct StrList **pStrList, size_t index, char *value) { const size_t len = strlen(value) + 1; memset((*pStrList)->data[index], '\0', len); - strncpy((*pStrList)->data[index], value, len); - (*pStrList)->data[index][len] = '\0'; + safe_strncpy((*pStrList)->data[index], value, len); } } -- cgit