1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-26 11:42:09 +00:00

nyx: Cover edge case on backup/restore checks for partition manager

An edge was fixed where the checks for if it's possible to backup files for partition manager would overflow and end up with a value < 1GB and thus proceeding to the backup/restore process.
This commit is contained in:
CTCaer 2021-01-10 02:09:03 +02:00
parent 53c9ca8072
commit 74b91b0085

View file

@ -134,7 +134,12 @@ static int _backup_and_restore_files(char *path, u32 *total_files, u32 *total_si
// Check for overflow. // Check for overflow.
if ((file_size + *total_size) < *total_size) if ((file_size + *total_size) < *total_size)
{
// Set size to > 1GB, skip next folders and return.
*total_size = 0x80000000;
res = -1;
break; break;
}
*total_size += file_size; *total_size += file_size;
*total_files += 1; *total_files += 1;
@ -177,7 +182,11 @@ static int _backup_and_restore_files(char *path, u32 *total_files, u32 *total_si
// If total is > 1GB exit. // If total is > 1GB exit.
if (*total_size > (RAM_DISK_SZ - 0x1000000)) // 0x2400000. if (*total_size > (RAM_DISK_SZ - 0x1000000)) // 0x2400000.
{
// Skip next folders and return.
res = -1;
break; break;
}
} }
else // It's a directory. else // It's a directory.
{ {