twn_util.c: fix redundant and erroneous NULL placement in expand_asterisk()
This commit is contained in:
parent
2b25ac8c21
commit
90361d1caf
@ -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 */
|
char *str = SDL_malloc(mask_len + to_len); /* NULL included, replacing the original asterisk */
|
||||||
SDL_memcpy(str, mask, offset - mask);
|
SDL_memcpy(str, mask, offset - mask);
|
||||||
SDL_memcpy(str + (offset - mask), to, to_len);
|
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));
|
SDL_memcpy(str + (offset - mask) + to_len, offset + 1, mask_len - (offset - mask));
|
||||||
str[mask_len + to_len] = '\0';
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user