From 74b91b0085c781bbad368c3ccdf3efbc3aa61ae6 Mon Sep 17 00:00:00 2001 From: CTCaer Date: Sun, 10 Jan 2021 02:09:03 +0200 Subject: [PATCH] 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. --- nyx/nyx_gui/frontend/gui_tools_partition_manager.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nyx/nyx_gui/frontend/gui_tools_partition_manager.c b/nyx/nyx_gui/frontend/gui_tools_partition_manager.c index 38045e9..9ea0167 100644 --- a/nyx/nyx_gui/frontend/gui_tools_partition_manager.c +++ b/nyx/nyx_gui/frontend/gui_tools_partition_manager.c @@ -134,7 +134,12 @@ static int _backup_and_restore_files(char *path, u32 *total_files, u32 *total_si // Check for overflow. if ((file_size + *total_size) < *total_size) + { + // Set size to > 1GB, skip next folders and return. + *total_size = 0x80000000; + res = -1; break; + } *total_size += file_size; *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_size > (RAM_DISK_SZ - 0x1000000)) // 0x2400000. + { + // Skip next folders and return. + res = -1; break; + } } else // It's a directory. {