From 250a82e9c3c55e92fc5d83e78c0fadb9e7ba8b49 Mon Sep 17 00:00:00 2001 From: Thorsten Töpper Date: Sun, 10 Aug 2025 20:09:21 +0200 Subject: split_for_sort: switch from strncpy to memcpy --- src/split_for_sort.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/split_for_sort.c b/src/split_for_sort.c index 8f5d8b8..e57c2b3 100644 --- a/src/split_for_sort.c +++ b/src/split_for_sort.c @@ -104,7 +104,7 @@ inline size_t list_check_length(struct list_head *list) { } inline int push_into_list_unique(struct list_head *list, char *name) { - size_t name_length = 0; /* required for __builtin___strncpy_chk */ + size_t name_length = 0; struct list_node *ptr = NULL, *tmp = NULL; if (list == NULL || name == NULL || name[0] == '\0') { LOGERR("ERROR: Invalid function arguments.\n"); @@ -124,12 +124,12 @@ inline int push_into_list_unique(struct list_head *list, char *name) { } name_length = strlen(name); - if ((tmp->name = calloc(name_length+2, sizeof(char))) == NULL) { - LOGERR("ERROR Failed to allocate %lu bytes for data in list\n", strlen(name)+2); + if ((tmp->name = calloc(name_length+1, sizeof(char))) == NULL) { + LOGERR("ERROR Failed to allocate %lu bytes for data in list\n", strlen(name)+1); free(tmp); return -3; } - strncpy(tmp->name, name, name_length+1); + memcpy(tmp->name, name, name_length); tmp->fd = NULL; tmp->next = list->first; list->first = tmp; -- cgit v1.2.3-70-g09d2