OSDN Git Service

ext4_utils: Fix off-by-one bug in dentry size calculation
authorColin Cross <ccross@android.com>
Wed, 26 Jan 2011 05:44:37 +0000 (21:44 -0800)
committerColin Cross <ccross@android.com>
Wed, 26 Jan 2011 07:42:04 +0000 (23:42 -0800)
Change-Id: I1a1833dfd5d896acd1d823f8dbe925b8ff1fd5da

ext4_utils/contents.c

index 0f816b8..ba7e05f 100644 (file)
@@ -51,7 +51,7 @@ static struct ext4_dir_entry_2 *add_dentry(u8 *data, u32 *offset,
        struct ext4_dir_entry_2 *dentry;
 
        u32 start_block = *offset / info.block_size;
-       u32 end_block = (*offset + rec_len) / info.block_size;
+       u32 end_block = (*offset + rec_len - 1) / info.block_size;
        if (start_block != end_block) {
                /* Adding this dentry will cross a block boundary, so pad the previous
                   dentry to the block boundary */