diff --git a/haxloader/diffs/1.diff b/haxloader/diffs/1.diff index bf49caf..33b144d 100644 --- a/haxloader/diffs/1.diff +++ b/haxloader/diffs/1.diff @@ -50,7 +50,7 @@ diff -uNr a/source/brahma.c b/source/brahma.c + fseek(p , 0, SEEK_END); + psize = ftell(p); + if (psize > 5 && psize < 58) { -+ char path[psize + 1]; ++ char path[58]; + + fseek(p, 0, SEEK_SET); + u32 bytes_read = fread(path, 1, psize, p); @@ -58,7 +58,7 @@ diff -uNr a/source/brahma.c b/source/brahma.c + if (bytes_read == psize) { + if (path[psize - 1] == 0xA) psize--; + if (path[psize - 1] == 0xD) psize--; -+ if (psize > 5 && psize < 56 && path[0] == '/' && memcmp(&path[psize - 4], ".bin", 4)) { ++ if (psize > 5 && psize < 56 && path[0] == '/' && memcmp(path + psize - 4, ".bin", 4)) { + path[psize] = 0; + f = fopen(path, "rb"); + if (f) use_default = false; diff --git a/haxloader/source/main.c b/haxloader/source/main.c index 67b8035..39536fa 100644 --- a/haxloader/source/main.c +++ b/haxloader/source/main.c @@ -43,13 +43,13 @@ void main(void) if(pathSize > 5 && pathSize < 58) { - char path[pathSize + 1]; + char path[58]; unsigned int read; f_read(&pathFile, path, pathSize, &read); if(path[pathSize - 1] == 0xA) pathSize--; if(path[pathSize - 1] == 0xD) pathSize--; - if(pathSize > 5 && pathSize < 56 && path[0] == '/' && memcmp(&path[pathSize - 4], ".bin", 4) == 0) + if(pathSize > 5 && pathSize < 56 && path[0] == '/' && memcmp(path + pathSize - 4, ".bin", 4) == 0) { path[pathSize] = 0; foundPayload = f_open(&payload, path, FA_READ) == FR_OK; diff --git a/source/patches.c b/source/patches.c index aefee79..1655437 100644 --- a/source/patches.c +++ b/source/patches.c @@ -48,7 +48,7 @@ static inline void pathChanger(u8 *pos) if(path[pathSize - 1] == 0xA) pathSize--; if(path[pathSize - 1] == 0xD) pathSize--; - if(pathSize < 6 || pathSize > 57 || path[0] != '/' || memcmp(&path[pathSize - 4], ".bin", 4) != 0) return; + if(pathSize < 6 || pathSize > 57 || path[0] != '/' || memcmp(path + pathSize - 4, ".bin", 4) != 0) return; u16 finalPath[58]; for(u32 i = 0; i < pathSize; i++)