fix heap buffer overflow

==16726== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x600400139d99 at pc 0x5cb4d8 bp 0x7ffc88a3a050 sp 0x7ffc88a3a048
READ of size 1 at 0x600400139d99 thread T0
    #0 0x5cb4d7 in xmb_update_savestate_thumbnail_path /home/bp/RetroArch/menu/drivers/xmb.c:1071
This commit is contained in:
Brad Parker 2018-01-16 10:32:35 -05:00
parent 830b2e429d
commit daf0b55f80

View File

@ -1068,9 +1068,9 @@ static void xmb_update_savestate_thumbnail_path(void *data, unsigned i)
if (!string_is_empty(entry.label))
{
if ( (settings->bools.savestate_thumbnail_enable)
&& ((string_is_equal_fast(entry.label, "state_slot", 10))
|| (string_is_equal_fast(entry.label, "loadstate", 9))
|| (string_is_equal_fast(entry.label, "savestate", 9))))
&& ((string_is_equal(entry.label, "state_slot"))
|| (string_is_equal(entry.label, "loadstate"))
|| (string_is_equal(entry.label, "savestate"))))
{
size_t path_size = 8024 * sizeof(char);
char *path = (char*)malloc(8204 * sizeof(char));