diff options
author | Orestis | 2018-10-07 21:26:24 +0300 |
---|---|---|
committer | Michael Stapelberg | 2018-10-07 20:26:24 +0200 |
commit | 494efd49a26ed96d7b0d3d4f69099ccd83e2ccba (patch) | |
tree | 8528ff82b198c81ce970ef87301d8a649e3cd0ea /i3status.c | |
parent | Merge pull request #305 from David96/master (diff) |
strncpy + strlen is pointless (#312)
strlen already assumes that the string is NULL-terminated.
Fixes -Wstringop-overflow warning
Diffstat (limited to 'i3status.c')
-rw-r--r-- | i3status.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -227,9 +227,10 @@ static char *resolve_tilde(const char *path) { } else { head = globbuf.gl_pathv[0]; result = scalloc(strlen(head) + (tail ? strlen(tail) : 0) + 1); - strncpy(result, head, strlen(head)); - if (tail) - strncat(result, tail, strlen(tail)); + strcpy(result, head); + if (tail) { + strcat(result, tail); + } } globfree(&globbuf); |