Resizing a FAT file system crashes in libparted/fs/r/fat/count.c
flag_traverse_dir() if the length of any path name in the file system
overflows the 512 byte file_name local buffer.  Increase buffer to 4096,
PATH_MAX on Linux.

Reported in
https://bugzilla.gnome.org/show_bug.cgi?id=762448
---
 NEWS                       |    3 +++
 libparted/fs/r/fat/count.c |    2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/NEWS b/NEWS
index 96135ed..d7483b8 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,9 @@ GNU parted NEWS                                    -*- outline 
-*-
 
 ** Bug Fixes
 
+  libparted-fs-resize: Prevent crash resizing FAT file systems with very
+  deep directories with path names over 512 bytes long.
+
   Use 512b sector size when communicating with device-mapper. Fixes
   problems with partitions being created too small on dm devices
   with sector sizes > 5121b
diff --git a/libparted/fs/r/fat/count.c b/libparted/fs/r/fat/count.c
index 7949e47..a5837c0 100644
--- a/libparted/fs/r/fat/count.c
+++ b/libparted/fs/r/fat/count.c
@@ -219,7 +219,7 @@ flag_traverse_dir (FatTraverseInfo* trav_info) {
        PedFileSystem*          fs = trav_info->fs;
        FatDirEntry*            this_entry;
        FatTraverseInfo*        subdir_trav_info;
-       char                    file_name [512];
+       char                    file_name [4096];
        char*                   file_name_start;
        FatCluster              first_cluster;
        PedSector               size;
-- 
1.7.1


Reply via email to