notaz.gp2x.de
/
pcsx_rearmed.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Properly protect the HLE instructions against corrupted memory.
[pcsx_rearmed.git]
/
frontend
/
libretro.c
diff --git
a/frontend/libretro.c
b/frontend/libretro.c
index
59e986e
..
e071daa
100644
(file)
--- a/
frontend/libretro.c
+++ b/
frontend/libretro.c
@@
-1337,14
+1337,12
@@
bool retro_load_game(const struct retro_game_info *info)
for (i = 0; i < sizeof(disks) / sizeof(disks[0]) && i < cdrIsoMultidiskCount; i++)
{
for (i = 0; i < sizeof(disks) / sizeof(disks[0]) && i < cdrIsoMultidiskCount; i++)
{
- char disk_name[PATH_MAX];
- char disk_label[PATH_MAX];
- disk_name[0] = '\0';
- disk_label[0] = '\0';
+ char disk_name[PATH_MAX - 16] = { 0 };
+ char disk_label[PATH_MAX] = { 0 };
disks[i].fname = strdup(info->path);
disks[i].fname = strdup(info->path);
- get_disk_label(disk_name, info->path,
PATH_MAX
);
+ get_disk_label(disk_name, info->path,
sizeof(disk_name)
);
snprintf(disk_label, sizeof(disk_label), "%s #%u", disk_name, (unsigned)i + 1);
disks[i].flabel = strdup(disk_label);
snprintf(disk_label, sizeof(disk_label), "%s #%u", disk_name, (unsigned)i + 1);
disks[i].flabel = strdup(disk_label);
@@
-2776,7
+2774,8
@@
void retro_init(void)
#ifdef _3DS
vout_buf = linearMemAlign(VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2, 0x80);
#elif defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L) && !defined(VITA) && !defined(__SWITCH__)
#ifdef _3DS
vout_buf = linearMemAlign(VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2, 0x80);
#elif defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L) && !defined(VITA) && !defined(__SWITCH__)
- posix_memalign(&vout_buf, 16, VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2);
+ if (posix_memalign(&vout_buf, 16, VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2) != 0)
+ vout_buf = (void *) 0;
#else
vout_buf = malloc(VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2);
#endif
#else
vout_buf = malloc(VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2);
#endif