From b73eee844b742bbac0fd48b7ad256e3ec4f1762f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Matthias=20K=C3=B6nig?= Date: Tue, 12 Jan 2010 13:58:28 +0100 Subject: [PATCH] libblkid: fix segfault in drdb MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Check if blkid_probe_get_buffer() returns NULL to avoid dereferencing a zero pointer resulting in a segfault. Signed-off-by: Matthias König --- shlibs/blkid/src/superblocks/drbd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; -- 2.39.5