]> 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>
Mon, 1 Oct 2012 09:37:32 +0000 (11:37 +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 63d1079d042b6add2b2f7dc41d4dcc2cdd65f70b..c461d445ce0f2de20f286c240353c7228e6486a8 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;