]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: make mnt_table_get_fs_root() more robust [gcc-analyzer]
authorKarel Zak <kzak@redhat.com>
Wed, 18 Aug 2021 09:02:45 +0000 (11:02 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 18 Aug 2021 09:02:45 +0000 (11:02 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/tab.c

index 110560176eb8a9dded399147139d0248b720448b..e1e308dc51b57c5d4f1e8d0f736924c5fab2ae90 100644 (file)
@@ -1665,7 +1665,7 @@ struct libmnt_fs *mnt_table_get_fs_root(struct libmnt_table *tb,
 
                DBG(FS, ul_debugobj(fs, "source root: %s, source FS root: %s", root, src_root));
 
-               if (src_root && !startswith(root, src_root)) {
+               if (src_root && root && !startswith(root, src_root)) {
                        if (strcmp(root, "/") == 0) {
                                free(root);
                                root = strdup(src_root);