diff --git a/exceptions/arm9/Makefile b/exceptions/arm9/Makefile index 357c81c..2088efe 100644 --- a/exceptions/arm9/Makefile +++ b/exceptions/arm9/Makefile @@ -13,7 +13,7 @@ dir_build := build dir_out := ../../$(dir_build) ASFLAGS := -mcpu=arm946e-s -CFLAGS := -Wall -Wextra -mthumb $(ASFLAGS) -fno-builtin -std=c11 -Wno-main -O2 -flto -ffast-math +CFLAGS := -Wall -Wextra -mthumb $(ASFLAGS) -fno-builtin -std=c11 -Wno-main -O2 -flto -ffast-math LDFLAGS := -nostdlib objects = $(patsubst $(dir_source)/%.s, $(dir_build)/%.o, \ diff --git a/source/patches.c b/source/patches.c index 82919b2..a8b6ef2 100644 --- a/source/patches.c +++ b/source/patches.c @@ -50,12 +50,14 @@ static inline void pathChanger(u8 *pos) if(pathSize < 6 || pathSize > 57 || path[0] != '/' || memcmp(&path[pathSize - 4], ".bin", 4) != 0) return; - u16 finalPath[pathSize]; + u16 finalPath[pathSize + 1]; for(u32 i = 0; i < pathSize; i++) finalPath[i] = (u16)path[i]; + finalPath[pathSize] = 0; + u8 *posPath = memsearch(pos, u"sd", reboot_bin_size, 4) + 0xA; - memcpy(posPath, finalPath, pathSize * 2); + memcpy(posPath, finalPath, (pathSize + 1) * 2); } u8 *getProcess9Info(u8 *pos, u32 size, u32 *process9Size, u32 *process9MemAddr)