strncpy + strlen is pointless (#312)
strlen already assumes that the string is NULL-terminated. Fixes -Wstringop-overflow warning
This commit is contained in:
parent
5c9d12befa
commit
494efd49a2
@ -227,9 +227,10 @@ static char *resolve_tilde(const char *path) {
|
|||||||
} else {
|
} else {
|
||||||
head = globbuf.gl_pathv[0];
|
head = globbuf.gl_pathv[0];
|
||||||
result = scalloc(strlen(head) + (tail ? strlen(tail) : 0) + 1);
|
result = scalloc(strlen(head) + (tail ? strlen(tail) : 0) + 1);
|
||||||
strncpy(result, head, strlen(head));
|
strcpy(result, head);
|
||||||
if (tail)
|
if (tail) {
|
||||||
strncat(result, tail, strlen(tail));
|
strcat(result, tail);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
globfree(&globbuf);
|
globfree(&globbuf);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user