diff options
author | Karel Zak | 2010-03-08 13:05:09 +0100 |
---|---|---|
committer | Karel Zak | 2010-03-08 13:05:09 +0100 |
commit | 74b1659ddaac4aa409b56d1eaa07d87b5b11b98e (patch) | |
tree | aa463609be09da549d3ce6897146c072d9caf9bf /shlibs/blkid | |
parent | libblkid: cleanup usage of empty topology values (diff) | |
download | kernel-qcow2-util-linux-74b1659ddaac4aa409b56d1eaa07d87b5b11b98e.tar.gz kernel-qcow2-util-linux-74b1659ddaac4aa409b56d1eaa07d87b5b11b98e.tar.xz kernel-qcow2-util-linux-74b1659ddaac4aa409b56d1eaa07d87b5b11b98e.zip |
libblkid: more robust minix probing
Unfortunately, it's still possible to interpret some parts of ext3
filesystem as minix superblock ;-(
So, the most robust is to check for the extN magic string in minix
probing function.
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=570606
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/blkid')
-rw-r--r-- | shlibs/blkid/src/superblocks/minix.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/shlibs/blkid/src/superblocks/minix.c b/shlibs/blkid/src/superblocks/minix.c index 7b314abc9..3290c2755 100644 --- a/shlibs/blkid/src/superblocks/minix.c +++ b/shlibs/blkid/src/superblocks/minix.c @@ -9,6 +9,7 @@ * GNU Lesser General Public License. */ +#include <string.h> #include "superblocks.h" struct minix_super_block { @@ -45,6 +46,7 @@ struct minix3_super_block { static int probe_minix(blkid_probe pr, const struct blkid_idmag *mag) { + unsigned char *ext; int version; /* for more details see magic strings below */ @@ -88,6 +90,14 @@ static int probe_minix(blkid_probe pr, const struct blkid_idmag *mag) } + /* unfortunately, some parts of ext3 is sometimes possible to + * interpreted as minix superblock. So check for extN magic + * string. (For extN magic string and offsets see ext.c.) + */ + ext = blkid_probe_get_buffer(pr, 0x400 + 0x38, 2); + if (ext && memcmp(ext, "\123\357", 2) == 0) + return -1; + blkid_probe_sprintf_version(pr, "%d", version); return 0; } |