From 90361d1caffc1d1d06c1643fe928125a851d7e51 Mon Sep 17 00:00:00 2001 From: veclavtalica Date: Fri, 27 Sep 2024 17:55:33 +0300 Subject: [PATCH] twn_util.c: fix redundant and erroneous NULL placement in expand_asterisk() --- src/twn_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; }