diff --git a/src/twn_util.c b/src/twn_util.c index 29f9503..6be2b51 100644 --- a/src/twn_util.c +++ b/src/twn_util.c @@ -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; }