aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2018-03-27 17:43:37 -0500
committerEric Sandeen <sandeen@redhat.com>2018-03-27 17:43:37 -0500
commit8aee048310cb23a94bbee0ddd058c00e84982a55 (patch)
treee38aeeca6cab4ccd91fa5329933021d8ee82edb3
parent6d135e8444aa33de7818c730d5a71d4517dcbd4f (diff)
downloadxfsprogs-dev-8aee048310cb23a94bbee0ddd058c00e84982a55.tar.gz
libfrog: handle NULL dir && blkdev in __fs_table_lookup_mount
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>
-rw-r--r--libfrog/paths.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libfrog/paths.c b/libfrog/paths.c
index 318b48f99e..c7895e9b2a 100644
--- a/libfrog/paths.c
+++ b/libfrog/paths.c
@@ -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))