mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-03 17:56:17 +01:00
gunixmounts: Fix a potential strcmp(NULL) call
mntent->mnt_fsname may be NULL at this point; if so, fall to the second branch and set mount_entry->device_path = NULL. Found by scan-build. https://bugzilla.gnome.org/show_bug.cgi?id=113075
This commit is contained in:
parent
8b9e8dc53b
commit
73e6b900d4
@ -418,7 +418,7 @@ _g_get_unix_mounts (void)
|
|||||||
|
|
||||||
mount_entry = g_new0 (GUnixMountEntry, 1);
|
mount_entry = g_new0 (GUnixMountEntry, 1);
|
||||||
mount_entry->mount_path = g_strdup (mntent->mnt_dir);
|
mount_entry->mount_path = g_strdup (mntent->mnt_dir);
|
||||||
if (strcmp (mntent->mnt_fsname, "/dev/root") == 0)
|
if (g_strcmp0 (mntent->mnt_fsname, "/dev/root") == 0)
|
||||||
mount_entry->device_path = g_strdup (_resolve_dev_root ());
|
mount_entry->device_path = g_strdup (_resolve_dev_root ());
|
||||||
else
|
else
|
||||||
mount_entry->device_path = g_strdup (mntent->mnt_fsname);
|
mount_entry->device_path = g_strdup (mntent->mnt_fsname);
|
||||||
|
Loading…
Reference in New Issue
Block a user