[glib] gunixmounts: Fix a potential strcmp(NULL) call



commit 73e6b900d431f8ef948aa134e45107bd326e8004
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Tue Nov 26 11:16:57 2013 +0000

    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

 gio/gunixmounts.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gio/gunixmounts.c b/gio/gunixmounts.c
index 03f1720..41565be 100644
--- a/gio/gunixmounts.c
+++ b/gio/gunixmounts.c
@@ -418,7 +418,7 @@ _g_get_unix_mounts (void)
       
       mount_entry = g_new0 (GUnixMountEntry, 1);
       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 ());
       else
         mount_entry->device_path = g_strdup (mntent->mnt_fsname);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]