From: Karel Zak Date: Mon, 8 Mar 2010 12:05:09 +0000 (+0100) Subject: libblkid: more robust minix probing X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c326223c7b20a367f634de07997e186092d7cb0f;p=util-linux 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 --- diff --git a/shlibs/blkid/src/superblocks/minix.c b/shlibs/blkid/src/superblocks/minix.c index 7b314abc..3290c275 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 #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; }