Fixed potential overflow

This commit is contained in:
Lior Halphon 2016-07-13 23:07:36 +03:00
parent d49404d248
commit c3f1eb26b1

View File

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