Fixed potential overflow

This commit is contained in:
Lior Halphon 2016-07-13 23:07:36 +03:00
parent d49404d248
commit c3f1eb26b1
1 changed files with 5 additions and 0 deletions

View File

@ -44,6 +44,11 @@ static const char *value_to_string(GB_gameboy_t *gb, uint16_t value, bool prefer
symbol = NULL; symbol = NULL;
} }
/* Avoid overflow */
if (strlen(symbol->name) > 240) {
symbol = NULL;
}
if (!symbol) { if (!symbol) {
sprintf(output, "$%04x", value); sprintf(output, "$%04x", value);
} }