diff --git a/modfetch.c b/modfetch.c index 5a481e1..f913e52 100644 --- a/modfetch.c +++ b/modfetch.c @@ -60,10 +60,10 @@ char *remove_whitespaces(const char *str) { i += 1; j += 1; } - tmp[j] = '\0'; char *ret = malloc(j * sizeof(char)); strncpy(ret, tmp, j); + ret[j] = '\0'; return ret; }