OSDN Git Service

utils.c: Fixed apparently incorrect initial value of 'bmpmref'.
authorErik Larsson <mechie@users.sourceforge.net>
Mon, 9 Jan 2012 02:27:29 +0000 (03:27 +0100)
committerErik Larsson <mechie@users.sourceforge.net>
Fri, 13 Jan 2012 07:54:45 +0000 (08:54 +0100)
This bug led 'utils_mftrec_in_use' to use 'cached' data before it had
been initialized (i.e. its contents was undefined), producing incorrect
results for the first 3584 MFT entries.

ntfsprogs/utils.c

index e3f5447..2836723 100644 (file)
@@ -782,7 +782,7 @@ int utils_cluster_in_use(ntfs_volume *vol, long long lcn)
 int utils_mftrec_in_use(ntfs_volume *vol, MFT_REF mref)
 {
        static u8 buffer[512];
-       static s64 bmpmref = -sizeof(buffer) - 1; /* Which bit of $BITMAP is in the buffer */
+       static s64 bmpmref = -(sizeof(buffer) << 3) - 1; /* Which bit of $BITMAP is in the buffer */
        int byte, bit;
 
        ntfs_log_trace("Entering.\n");