diff options
author | Karel Zak | 2012-09-12 11:57:19 +0200 |
---|---|---|
committer | Karel Zak | 2012-09-12 11:57:19 +0200 |
commit | 3de77c2173e5bc8664a427ce9a8b08c68eea7c7f (patch) | |
tree | 80556bc44dd6454514a9aad406a9ace98c66c09b | |
parent | mount: losetup: remove obsolete encryption support (diff) | |
download | kernel-qcow2-util-linux-3de77c2173e5bc8664a427ce9a8b08c68eea7c7f.tar.gz kernel-qcow2-util-linux-3de77c2173e5bc8664a427ce9a8b08c68eea7c7f.tar.xz kernel-qcow2-util-linux-3de77c2173e5bc8664a427ce9a8b08c68eea7c7f.zip |
libmount: segfaults if neither /etc/filesystems nor/proc/filesystems exists
Reported-by: Juergen Daubert <jue@jue.li>
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | libmount/src/context_mount.c | 3 | ||||
-rw-r--r-- | libmount/src/utils.c | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c index f3d8ff103..fdb459c32 100644 --- a/libmount/src/context_mount.c +++ b/libmount/src/context_mount.c @@ -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)) diff --git a/libmount/src/utils.c b/libmount/src/utils.c index 245a3b25d..0cfefb347 100644 --- a/libmount/src/utils.c +++ b/libmount/src/utils.c @@ -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; |