summaryrefslogtreecommitdiff
blob: 9acc8849a6de109d061bcdcccca77e6e5f16ba0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From 10f494e1a0ac09e144a42fcaeb72663674eb30fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Matthias=20K=C3=B6nig?= <mk@phasorlab.de>
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=UTF-8
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 <mk@phasorlab.de>
---
 shlibs/blkid/src/superblocks/drbd.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/shlibs/blkid/src/superblocks/drbd.c b/shlibs/blkid/src/superblocks/drbd.c
index e0bbb4d..a56486e 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;
-- 
1.6.6.1