Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=fw-control-center.git;a=commitdiff;h=bd62d9ba858bdda824993c47fc96a1361dadebf0

commit bd62d9ba858bdda824993c47fc96a1361dadebf0
Author: Priyank <[EMAIL PROTECTED]>
Date:   Mon Nov 12 20:51:06 2007 +0530

gnetconfig-interface: fixed a segfault
* gnetconfig gets the last used profile name from fwnet_parseprofile() and
uses strcmp() to compare it with the list of currently available profiles.
But, fwnet_parseprofile() might return NULL in case when no profile was used.
This might cause gnetconfig to crash on a NULL comparsion. It's better to check 
the value
returned by fwnet_parseprofile() before performing a comparison.

diff --git a/gnetconfig/src/gnetconfig-interface.c 
b/gnetconfig/src/gnetconfig-interface.c
index adbe696..5dfc4bd 100644
--- a/gnetconfig/src/gnetconfig-interface.c
+++ b/gnetconfig/src/gnetconfig-interface.c
@@ -407,6 +407,7 @@ gnetconfig_populate_interface_list (fwnet_profile_t 
*profile)
GdkPixbuf               *wired_pixbuf;
GdkPixbuf               *wireless_pixbuf;
gchar                   *ptr = NULL;
+       gchar                   *old_profile = NULL;
gboolean                flag = FALSE;

n_ifs = g_list_length (profile->interfaces);
@@ -426,8 +427,10 @@ gnetconfig_populate_interface_list (fwnet_profile_t 
*profile)
wireless_pixbuf = gdk_pixbuf_new_from_file_at_size (ptr, 26, 26, NULL);
g_free (ptr);

-       if ((strcmp(profile->name, fwnet_lastprofile())) == 0)
-               flag = TRUE;
+       old_profile = fwnet_lastprofile ();
+       if (old_profile!=NULL)
+               if ((strcmp(profile->name, old_profile)) == 0)
+                       flag = TRUE;

for (i=0;i<n_ifs;i++)
{
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to