|
|
9bf599 |
commit 595629131dbe6c5fb16d03e87bc2cb71ad3dcc4b
|
|
|
9bf599 |
Author: Eric Sandeen <sandeen@redhat.com>
|
|
|
9bf599 |
Date: Wed Feb 15 21:48:31 2017 -0600
|
|
|
9bf599 |
|
|
|
9bf599 |
xfs_metadump: ignore attr leaf with 0 entries
|
|
|
9bf599 |
|
|
|
9bf599 |
Another in the ongoing saga of attribute leaves with zero
|
|
|
9bf599 |
entries; in this case, if we try to metadump an inode with
|
|
|
9bf599 |
a zero-entries attribute leaf, the zeroing code will go off
|
|
|
9bf599 |
the rails and segfault at:
|
|
|
9bf599 |
|
|
|
9bf599 |
memset(&entries[nentries], 0,
|
|
|
9bf599 |
first_name - (char *)&entries[nentries]);
|
|
|
9bf599 |
|
|
|
9bf599 |
because first_name is null, and we try to memset a large
|
|
|
9bf599 |
(negative) number.
|
|
|
9bf599 |
|
|
|
9bf599 |
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
9bf599 |
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
|
|
|
9bf599 |
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
|
|
|
9bf599 |
|
|
|
9bf599 |
diff --git a/db/metadump.c b/db/metadump.c
|
|
|
9bf599 |
index 38519f1..66952f6 100644
|
|
|
9bf599 |
--- a/db/metadump.c
|
|
|
9bf599 |
+++ b/db/metadump.c
|
|
|
9bf599 |
@@ -1654,7 +1654,8 @@ process_attr_block(
|
|
|
9bf599 |
xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &hdr, leaf);
|
|
|
9bf599 |
|
|
|
9bf599 |
nentries = hdr.count;
|
|
|
9bf599 |
- if (nentries * sizeof(xfs_attr_leaf_entry_t) +
|
|
|
9bf599 |
+ if (nentries == 0 ||
|
|
|
9bf599 |
+ nentries * sizeof(xfs_attr_leaf_entry_t) +
|
|
|
9bf599 |
xfs_attr3_leaf_hdr_size(leaf) >
|
|
|
9bf599 |
XFS_ATTR3_RMT_BUF_SPACE(mp, bs)) {
|
|
|
9bf599 |
if (show_warnings)
|