diff --git a/Core/save_state.c b/Core/save_state.c index 1cd3458..5a7d920 100644 --- a/Core/save_state.c +++ b/Core/save_state.c @@ -294,6 +294,8 @@ static bool buffer_read_section(const uint8_t **buffer, size_t *buffer_length, v return false; } + if (saved_size > *buffer_length) return false; + if (saved_size <= size) { if (buffer_read(dest, saved_size, buffer, buffer_length) != saved_size) { return false;