Consistency

This commit is contained in:
Aurora 2016-12-11 19:51:11 +01:00
parent 38088e80e1
commit 2f274e2f47
3 changed files with 5 additions and 5 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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++)