twn_util.c: fix redundant and erroneous NULL placement in expand_asterisk()

This commit is contained in:
veclav talica 2024-09-27 17:55:33 +03:00
parent 2b25ac8c21
commit 90361d1caf

View File

@ -290,7 +290,7 @@ char *expand_asterisk(const char *mask, const char *to) {
char *str = SDL_malloc(mask_len + to_len); /* NULL included, replacing the original asterisk */
SDL_memcpy(str, mask, offset - mask);
SDL_memcpy(str + (offset - mask), to, to_len);
/* NULL byte is copied from here */
SDL_memcpy(str + (offset - mask) + to_len, offset + 1, mask_len - (offset - mask));
str[mask_len + to_len] = '\0';
return str;
}