fixes for memory leaks and out of bounds memory access found by ASAN or gcc -flto

This commit is contained in:
kub 2020-12-12 14:57:56 +01:00
parent bb70cc6e66
commit a20300bf1e
8 changed files with 27 additions and 12 deletions

View file

@ -131,8 +131,8 @@ static void fname_ext(char *dst, int dstlen, const char *prefix, const char *ext
strncpy(dst + prefix_len, p, dstlen - prefix_len - 1);
dst[dstlen - 8] = 0;
if (dst[strlen(dst) - 4] == '.')
dst[strlen(dst) - 4] = 0;
if ((p = strrchr(dst, '.')) != NULL)
dst[p-dst] = 0;
if (ext)
strcat(dst, ext);
}