From 292ed050658338a4e29804035dec4c2922f94a6d Mon Sep 17 00:00:00 2001 From: JoseAaronLopezGarcia Date: Sat, 27 Jul 2024 21:43:17 +0200 Subject: [PATCH] add safety checks --- core/popcorn/main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/popcorn/main.c b/core/popcorn/main.c index c8cbe749..ea8cde5a 100644 --- a/core/popcorn/main.c +++ b/core/popcorn/main.c @@ -451,7 +451,14 @@ static int myIoRead(int fd, unsigned char *buf, int size) if (offset == 0) break; if (offset+0x400 == pos && size-0x20 >= config_size){ - memcpy(buf+0x20, custom_config, config_size); + char magic[12]; + sceIoLseek(fd, offset, PSP_SEEK_SET); + sceIoRead(fd, magic, sizeof(magic)); + sceIoLseek(fd, pos+size, PSP_SEEK_SET); + if (strncmp(magic, "PSISOIMG", 8) == 0){ + memcpy(buf+0x20, custom_config, config_size); + } + break; } } }