resolve_tilde: strncpy + strlen is pointless (#3436)
strlen already assumes that the string is NULL-terminated. Like in https://github.com/i3/i3status/pull/312 but for whatever reason gcc didn't warn about this here.
This commit is contained in:
parent
18dbfe699a
commit
2be4975f18
|
@ -35,9 +35,10 @@ 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, 1);
|
result = scalloc(strlen(head) + (tail ? strlen(tail) : 0) + 1, 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