From 040f273035ca84fc963d0d0c0b39794f7a5fc7d4 Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Fri, 14 Sep 2012 14:54:40 +0100 Subject: [PATCH] extlinux: Handle error case for find_mount() find_mount() may return NULL, so we'd really better check for that *before* dereferencing the pointer. Signed-off-by: Matt Fleming --- extlinux/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extlinux/main.c b/extlinux/main.c index 73f3fbe..d7a239e 100644 --- a/extlinux/main.c +++ b/extlinux/main.c @@ -915,6 +915,8 @@ static const char *find_device_mountinfo(const char *path, dev_t dev) struct stat st; m = find_mount(path, NULL); + if (!m) + return NULL; if (m->devpath[0] == '/' && m->dev == dev && !stat(m->devpath, &st) && S_ISBLK(st.st_mode) && st.st_rdev == dev) -- 2.7.4