From: Matthias König Date: Tue, 12 Jan 2010 12:58:28 +0000 (+0100) Subject: libblkid: fix segfault in drdb X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b73eee844b742bbac0fd48b7ad256e3ec4f1762f;p=util-linux libblkid: fix segfault in drdb Check if blkid_probe_get_buffer() returns NULL to avoid dereferencing a zero pointer resulting in a segfault. Signed-off-by: Matthias König --- diff --git a/shlibs/blkid/src/superblocks/drbd.c b/shlibs/blkid/src/superblocks/drbd.c index e0bbb4d6..a56486e9 100644 --- a/shlibs/blkid/src/superblocks/drbd.c +++ b/shlibs/blkid/src/superblocks/drbd.c @@ -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;