strncpy warnings fixed: stringop-truncation and stringop-overflow

This commit is contained in:
Olof Hagsand 2020-11-17 07:35:50 -06:00
parent 4eee00101c
commit a2bef12ce0
4 changed files with 33 additions and 20 deletions

View file

@ -80,7 +80,7 @@ static inline char * strdup4(char *str)
len = align4(strlen(str)+1);
if ((dup = (char*) malloc(len)) == NULL)
return NULL;
strncpy(dup, str, len);
memcpy(dup, str, strlen(str)+1);
return dup;
}