Skip to content
Snippets Groups Projects
Commit 9fcf5a29 authored by Rareş-Andrei TICUŞ's avatar Rareş-Andrei TICUŞ
Browse files

Replaced completely strncpy with memcpy

parent d116f942
No related branches found
No related tags found
No related merge requests found
Pipeline #50747 passed
...@@ -86,12 +86,12 @@ static char *get_exec_name(char *name) ...@@ -86,12 +86,12 @@ static char *get_exec_name(char *name)
} }
path_len = strlen(path); path_len = strlen(path);
full_name = malloc(path_len + name_len + 1); full_name = malloc(path_len + name_len + 2);
DIE(full_name == NULL, "malloc"); DIE(full_name == NULL, "malloc");
strncpy(full_name, path, path_len); memcpy(full_name, path, path_len);
full_name[path_len] = '/'; full_name[path_len] = '/';
strncpy(full_name + path_len + 1, name, name_len + 1); memcpy(full_name + path_len + 1, name, name_len + 1);
if (stat(full_name, &buff) == 0) if (stat(full_name, &buff) == 0)
return full_name; return full_name;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment