From 6159284be6d73e94790a2b5bf4124a0414534181 Mon Sep 17 00:00:00 2001 From: CTCaer Date: Mon, 15 Jun 2020 15:05:47 +0300 Subject: [PATCH] nyx: Check for huge files in part manager backup --- nyx/nyx_gui/frontend/gui_tools_partition_manager.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nyx/nyx_gui/frontend/gui_tools_partition_manager.c b/nyx/nyx_gui/frontend/gui_tools_partition_manager.c index b6657c5..9956ee5 100644 --- a/nyx/nyx_gui/frontend/gui_tools_partition_manager.c +++ b/nyx/nyx_gui/frontend/gui_tools_partition_manager.c @@ -126,6 +126,11 @@ static int _backup_and_restore_files(char *path, u32 *total_files, u32 *total_si if (!(fno.fattrib & AM_DIR)) { u32 file_size = fno.fsize > RAMDISK_CLUSTER_SZ ? fno.fsize : RAMDISK_CLUSTER_SZ; // Ramdisk cluster size. + + // Check for overflow. + if ((file_size + *total_size) < *total_size) + break; + *total_size += file_size; *total_files += 1;