]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: segfaults if neither /etc/filesystems nor/proc/filesystems exists
authorKarel Zak <kzak@redhat.com>
Wed, 12 Sep 2012 09:57:19 +0000 (11:57 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 12 Sep 2012 09:57:19 +0000 (11:57 +0200)
Reported-by: Juergen Daubert <jue@jue.li>
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/context_mount.c
libmount/src/utils.c

index f3d8ff103b0153a4f0f96005eef63dcce1a778c2..fdb459c32350f76e1437724e4d993bf1078c3785 100644 (file)
@@ -587,6 +587,9 @@ static int do_mount_by_pattern(struct libmnt_context *cxt, const char *pattern)
        if (rc)
                return rc;
 
+       if (filesystems == NULL)
+               return -MNT_ERR_NOFSTYPE;
+
        for (fp = filesystems; *fp; fp++) {
                rc = do_mount(cxt, *fp);
                if (mnt_context_get_status(cxt))
index 245a3b25d3ad2b235d3f94531705d9048a1bb09f..0cfefb3474f9cdd24a6cbc88784bda0cb48e2ea2 100644 (file)
@@ -473,6 +473,10 @@ static int get_filesystems(const char *filename, char ***filesystems, const char
        return rc;
 }
 
+/*
+ * Returns zero also if not found any matching filesystem. Always check
+ * @filesystems pointer!
+ */
 int mnt_get_filesystems(char ***filesystems, const char *pattern)
 {
        int rc;