Fixing overflow bug in reclaim_file function, see

https://bugzilla.redhat.com/show_bug.cgi?id=660154 for more information.

The problem is that alloc_rootdir_entry counts with 10000 files at max, but the
filename buffer is only 8 chars long. Due to pattern mask used it results to
only 10 files at max (FSCK0-9REC). If there is more than 10 files, it overflows
and hangs.

Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
This commit is contained in:
Jaroslav Skarvada 2011-01-06 22:35:00 +01:00 committed by Daniel Baumann
parent e0366dac97
commit 4a8f8a6645

View File

@ -474,7 +474,7 @@ void reclaim_file(DOS_FS * fs)
DIR_ENT de;
loff_t offset;
files++;
offset = alloc_rootdir_entry(fs, &de, "FSCK%04dREC");
offset = alloc_rootdir_entry(fs, &de, "FSCK%04d");
de.start = CT_LE_W(i & 0xffff);
if (fs->fat_bits == 32)
de.starthi = CT_LE_W(i >> 16);