]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libfrog: handle NULL dir && blkdev in __fs_table_lookup_mount
authorEric Sandeen <sandeen@redhat.com>
Tue, 27 Mar 2018 22:43:37 +0000 (17:43 -0500)
committerEric Sandeen <sandeen@redhat.com>
Tue, 27 Mar 2018 22:43:37 +0000 (17:43 -0500)
If neither dir nor blkdev is set, dpath never gets set,
and then gets used (uninitalized) later on.

If we are asked where "nothing" is mounted, just return
"nowhere."

Fixes-coverity-id: 1433615
Fixes-coverity-id: 1433616
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libfrog/paths.c

index 318b48f99e1d2bd42e44e5a32c68dab7c2781786..c7895e9b2ab68aef13582e8ff8cb33dc08e80e55 100644 (file)
@@ -98,6 +98,9 @@ __fs_table_lookup_mount(
        char            rpath[PATH_MAX];
        char            dpath[PATH_MAX];
 
+       if (!dir && !blkdev)
+               return NULL;
+
        if (dir && !realpath(dir, dpath))
                return NULL;
        if (blkdev && !realpath(blkdev, dpath))