]> err.no Git - util-linux/commitdiff
libblkid: fix segfault in drdb
authorMatthias König <mk@phasorlab.de>
Tue, 12 Jan 2010 12:58:28 +0000 (13:58 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 16 Feb 2010 08:58:56 +0000 (09:58 +0100)
Check if blkid_probe_get_buffer() returns NULL to avoid dereferencing
a zero pointer resulting in a segfault.

Signed-off-by: Matthias König <mk@phasorlab.de>
shlibs/blkid/src/superblocks/drbd.c

index e0bbb4d669d45b6b6139493f5b7b3a2a5c922d0d..a56486e97984f37134b54a70056ef208ddc36067 100644 (file)
@@ -78,7 +78,8 @@ static int probe_drbd(blkid_probe pr, const struct blkid_idmag *mag)
                blkid_probe_get_buffer(pr,
                off,
                sizeof(struct md_on_disk_08));
-
+       if (!md)
+               return -1;
 
        if (be32_to_cpu(md->magic) != DRBD_MD_MAGIC_08)
                return -1;