From: Eric Sandeen Date: Tue, 27 Mar 2018 22:43:37 +0000 (-0500) Subject: libfrog: handle NULL dir && blkdev in __fs_table_lookup_mount X-Git-Tag: v4.16.0-rc1~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8aee048310cb23a94bbee0ddd058c00e84982a55;p=thirdparty%2Fxfsprogs-dev.git 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 Reviewed-by: Darrick J. Wong Signed-off-by: Eric Sandeen --- diff --git a/libfrog/paths.c b/libfrog/paths.c index 318b48f99..c7895e9b2 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))