Bugfix: Use scalloc to get a null-terminated string

This commit is contained in:
Michael Stapelberg 2010-07-24 12:32:03 +02:00
parent 4d4ce82b35
commit a6e7894b11
1 changed files with 1 additions and 1 deletions

View File

@ -59,7 +59,7 @@ char *resolve_tilde(const char *path) {
} }
else { else {
head = globbuf.gl_pathv[0]; head = globbuf.gl_pathv[0];
result = smalloc(strlen(head) + (tail ? strlen(tail) : 0) + 1); result = scalloc(strlen(head) + (tail ? strlen(tail) : 0) + 1);
strncpy(result, head, strlen(head)); strncpy(result, head, strlen(head));
strncat(result, tail, strlen(tail)); strncat(result, tail, strlen(tail));
} }