Whamcloud - gitweb
git://git.whamcloud.com
/
tools
/
e2fsprogs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
85e53f4
)
blkid: avoid FPE crash when probing a HFS+ superblock with a zero blocksize
author
Theodore Ts'o
<tytso@mit.edu>
Tue, 10 Jul 2018 22:12:54 +0000
(18:12 -0400)
committer
Theodore Ts'o
<tytso@mit.edu>
Tue, 10 Jul 2018 22:12:54 +0000
(18:12 -0400)
This problem was reported by Adam Buchbinder.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/blkid/probe.c
patch
|
blob
|
history
diff --git
a/lib/blkid/probe.c
b/lib/blkid/probe.c
index
865d9aa
..
283ee0a
100644
(file)
--- a/
lib/blkid/probe.c
+++ b/
lib/blkid/probe.c
@@
-1184,6
+1184,8
@@
static int probe_hfs(struct blkid_probe *probe __BLKID_ATTR((unused)),
}
+#define HFSPLUS_SECTOR_SIZE 512
+
static int probe_hfsplus(struct blkid_probe *probe,
struct blkid_magic *id,
unsigned char *buf)
@@
-1247,6
+1249,9
@@
static int probe_hfsplus(struct blkid_probe *probe,
}
blocksize = blkid_be32(hfsplus->blocksize);
+ if (blocksize < HFSPLUS_SECTOR_SIZE)
+ return 1;
+
memcpy(extents, hfsplus->cat_file.extents, sizeof(extents));
cat_block = blkid_be32(extents[0].start_block);