From c3f1eb26b16c979a92dcba0e39ded7dda2e68bec Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Wed, 13 Jul 2016 23:07:36 +0300 Subject: [PATCH] Fixed potential overflow --- Core/debugger.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Core/debugger.c b/Core/debugger.c index 04d7e97..51110e6 100644 --- a/Core/debugger.c +++ b/Core/debugger.c @@ -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); }