motherfucking strncpy

This commit is contained in:
jacekpoz 2024-02-09 22:07:49 +01:00
parent 727556295e
commit 24e2d04c68
No known key found for this signature in database
GPG key ID: 94E812A8B12AAE3C

View file

@ -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;
}