From 356a94cc2efb9cf36bf6d53d9a44133f283ccbbc Mon Sep 17 00:00:00 2001 From: TuxSH Date: Thu, 5 Apr 2018 23:20:30 +0200 Subject: [PATCH] Double the size of launchedPath --- patches/reboot.s | 2 +- source/main.c | 6 +++--- source/patches.c | 2 +- source/types.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/patches/reboot.s b/patches/reboot.s index 984ce8c..777f2ac 100644 --- a/patches/reboot.s +++ b/patches/reboot.s @@ -109,7 +109,7 @@ bytes_read: .word 0 fopen: .ascii "OPEN" .pool -.area 82, 0 +.area 2*(80+1), 0 fname: .ascii "FILE" .endarea diff --git a/source/main.c b/source/main.c index c351065..d8fea38 100644 --- a/source/main.c +++ b/source/main.c @@ -44,7 +44,7 @@ extern ConfigurationStatus needConfig; extern FirmwareSource firmSource; bool isSdMode; -u16 launchedPath[41]; +u16 launchedPath[80+1]; BootType bootType; void main(int argc, char **argv, u32 magicWord) @@ -66,7 +66,7 @@ void main(int argc, char **argv, u32 magicWord) bootType = isNtrBoot ? B9SNTR : B9S; u32 i; - for(i = 0; i < 40 && argv[0][i] != 0; i++) //Copy and convert the path to UTF-16 + for(i = 0; i < sizeof(launchedPath)/2 - 1 && argv[0][i] != 0; i++) //Copy and convert the path to UTF-16 launchedPath[i] = argv[0][i]; launchedPath[i] = 0; } @@ -76,7 +76,7 @@ void main(int argc, char **argv, u32 magicWord) u32 i; u16 *p = (u16 *)argv[0]; - for(i = 0; i < 40 && p[i] != 0; i++) + for(i = 0; i < sizeof(launchedPath)/2 - 1 && p[i] != 0; i++) launchedPath[i] = p[i]; launchedPath[i] = 0; } diff --git a/source/patches.c b/source/patches.c index 26de128..d687fcb 100644 --- a/source/patches.c +++ b/source/patches.c @@ -302,7 +302,7 @@ u32 patchFirmlaunches(u8 *pos, u32 size, u32 process9MemAddr) static const u8 pattern[] = {0xE2, 0x20, 0x20, 0x90}; u32 pathLen; - for(pathLen = 0; pathLen < 41 && launchedPath[pathLen] != 0; pathLen++); + for(pathLen = 0; pathLen < sizeof(launchedPath)/2 && launchedPath[pathLen] != 0; pathLen++); if(launchedPath[pathLen] != 0) return 1; diff --git a/source/types.h b/source/types.h index d810fdf..5bd8db1 100644 --- a/source/types.h +++ b/source/types.h @@ -129,4 +129,4 @@ extern bool isSdMode; extern BootType bootType; extern u16 launchedFirmTidLow[8]; -extern u16 launchedPath[41]; +extern u16 launchedPath[80+1];