diff options
author | Colin Cross <ccross@android.com> | 2015-05-03 14:09:52 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2015-05-03 14:09:52 -0700 |
commit | d05e047ec0bc574836131ae230cf75d3b93fb55c (patch) | |
tree | f9b8d2d98c689f28526b51f89f3e1efc60b84843 | |
parent | 0ae45f5bc3152c7643d4d7a9f0cb7f9803f99e81 (diff) | |
download | extras-d05e047ec0bc574836131ae230cf75d3b93fb55c.tar.gz |
Fix asan error when copying super block to backup super blocks
Address santizier caught a bug where we memcpy a full block size into
the backup super block, but the source may be offset 1024 bytes into
a block size allocation. The destination buffer is zeroed by calloc,
so just copy the super block size instead.
Change-Id: I87af8e3349a63940905697466f62532c50fab720
-rw-r--r-- | ext4_utils/ext4_utils.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ext4_utils/ext4_utils.c b/ext4_utils/ext4_utils.c index 06392932..29cbc727 100644 --- a/ext4_utils/ext4_utils.c +++ b/ext4_utils/ext4_utils.c @@ -363,7 +363,7 @@ void ext4_fill_in_sb(int real_uuid) if (ext4_bg_has_super_block(i)) { if (i != 0) { aux_info.backup_sb[i] = calloc(info.block_size, 1); - memcpy(aux_info.backup_sb[i], sb, info.block_size); + memcpy(aux_info.backup_sb[i], sb, sizeof(struct ext4_super_block)); /* Update the block group nr of this backup superblock */ aux_info.backup_sb[i]->s_block_group_nr = i; ext4_queue_sb(group_start_block, info.block_device ? |