diff options
Diffstat (limited to 'src/split_for_sort.c')
| -rw-r--r-- | src/split_for_sort.c | 8 |
1 files changed, 4 insertions, 4 deletions
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; |
