Skip to content

Commit

Permalink
Filter non-ASCII chars before using isalnum() in filter_char()
Browse files Browse the repository at this point in the history
This prevents exceptions when using MSVC's implementation
  • Loading branch information
ata4 committed Jul 14, 2019
1 parent 25d8a20 commit d6fb015
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/plugin/zilmar/gfx_1.3.c
Expand Up @@ -45,11 +45,17 @@ static bool is_valid_ptr(void *ptr, uint32_t bytes)

static char filter_char(char c)
{
if (isalnum(c) || c == '_' || c == '-') {
return c;
} else {
// only allow valid ASCII chars
if (c & 0x80) {
return ' ';
}

// only allow certain ASCII chars
if (!isalnum(c) && c != '_' && c != '-') {
return ' ';
}

return c;
}

static char* get_rom_name(void)
Expand Down

0 comments on commit d6fb015

Please sign in to comment.