diff options
author | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2006-04-24 08:50:59 +0800 |
---|---|---|
committer | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2006-04-24 08:50:59 +0800 |
commit | 47402fdc388e36acc7c3a718951cfeaf4d86a86c (patch) | |
tree | 2042e98eb082425f8f893ea968ab52a47eb0fd97 /net | |
parent | 713863990b1d893a12faf8cf786d60dbbc62b5ad (diff) | |
download | marcuscom-ports-47402fdc388e36acc7c3a718951cfeaf4d86a86c.tar marcuscom-ports-47402fdc388e36acc7c3a718951cfeaf4d86a86c.tar.gz marcuscom-ports-47402fdc388e36acc7c3a718951cfeaf4d86a86c.tar.bz2 marcuscom-ports-47402fdc388e36acc7c3a718951cfeaf4d86a86c.tar.lz marcuscom-ports-47402fdc388e36acc7c3a718951cfeaf4d86a86c.tar.xz marcuscom-ports-47402fdc388e36acc7c3a718951cfeaf4d86a86c.tar.zst marcuscom-ports-47402fdc388e36acc7c3a718951cfeaf4d86a86c.zip |
Prevent an uninitialized pointer from being freed.
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@6117 df743ca5-7f9a-e211-a948-0013205c9059
Diffstat (limited to 'net')
-rw-r--r-- | net/gnome-nettool/files/patch-src_info.c | 39 | ||||
-rw-r--r-- | net/gnomenettool/files/patch-src_info.c | 39 |
2 files changed, 54 insertions, 24 deletions
diff --git a/net/gnome-nettool/files/patch-src_info.c b/net/gnome-nettool/files/patch-src_info.c index 97015e4eb..0b8061d36 100644 --- a/net/gnome-nettool/files/patch-src_info.c +++ b/net/gnome-nettool/files/patch-src_info.c @@ -1,15 +1,17 @@ ---- src/info.c.orig Thu Jan 27 18:26:53 2005 -+++ src/info.c Sun Jul 3 17:46:31 2005 -@@ -20,6 +20,8 @@ +--- src/info.c.orig Mon Apr 3 15:41:33 2006 ++++ src/info.c Sun Apr 23 20:48:36 2006 +@@ -20,6 +20,10 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> #include <glib/gprintf.h> +#include <sys/types.h> +#include <string.h> ++#include <errno.h> ++#include <unistd.h> #ifdef HAVE_CONFIG_H # include <config.h> -@@ -38,6 +40,11 @@ +@@ -38,6 +42,11 @@ #include <sys/ioctl.h> #include <stdlib.h> #include <net/if.h> @@ -21,7 +23,7 @@ #include "info.h" #include "utils.h" -@@ -58,6 +65,7 @@ static InfoInterfaceDescription info_ifa +@@ -58,6 +67,7 @@ static InfoInterfaceDescription info_ifa { N_("Ethernet Interface"), INFO_INTERFACE_ETH, "16_ethernet.xpm", "eth", NULL }, { N_("Wireless Interface"), INFO_INTERFACE_WLAN, "wavelan-16.png", "wlan", NULL }, { N_("Modem Interface"), INFO_INTERFACE_PPP, "16_ppp.xpm", "ppp", NULL }, @@ -29,7 +31,7 @@ { N_("Parallel Line Interface"), INFO_INTERFACE_PLIP, "16_plip.xpm", "plip", NULL }, { N_("Infrared Interface"), INFO_INTERFACE_IRLAN, "irda-16.png", "irlan", NULL }, { N_("Loopback Interface"), INFO_INTERFACE_LO, "16_loopback.xpm", "lo", NULL }, -@@ -128,9 +136,42 @@ info_get_interface_from_dev_name (const +@@ -128,9 +138,42 @@ info_get_interface_from_dev_name (const { gint i; gchar *path; @@ -74,7 +76,7 @@ (*iface) = g_strdup_printf ("%s (%s)", _(info_iface_desc[i].name), dev_name); if (info_iface_desc[i].pixbuf == NULL) { path = g_build_filename (PIXMAPS_DIR, info_iface_desc[i].icon, NULL); -@@ -217,38 +258,87 @@ info_nic_update_stats (gpointer data) +@@ -217,38 +260,87 @@ info_nic_update_stats (gpointer data) gchar tx[10], tx_error[10], tx_drop[10], tx_ovr[10]; */ gchar iface[30]; /*, flags[30]; */ @@ -168,7 +170,7 @@ if (g_ascii_strcasecmp (iface, text) == 0) { /* -@@ -276,7 +366,9 @@ info_nic_update_stats (gpointer data) +@@ -276,7 +368,9 @@ info_nic_update_stats (gpointer data) } g_io_channel_unref (io); @@ -179,7 +181,7 @@ return TRUE; } -@@ -405,8 +497,16 @@ info_get_nic_information (const gchar *n +@@ -405,8 +499,19 @@ info_get_nic_information (const gchar *n InfoIpAddr *ip; gint flags; mii_data_result data; @@ -191,12 +193,16 @@ + struct sockaddr_dl *hwsinptr; +#endif - getifaddrs (&ifa0); +- getifaddrs (&ifa0); ++ if (getifaddrs (&ifa0) != 0) { ++ g_warning ("getifaddrs failed: %s", g_strerror (errno)); ++ goto fail; ++ } + memset (&data, 0, sizeof (data)); for (ifr6 = ifa0; ifr6; ifr6 = ifr6->ifa_next) { if (strcmp (ifr6->ifa_name, nic) != 0) { -@@ -452,7 +552,9 @@ info_get_nic_information (const gchar *n +@@ -452,7 +557,9 @@ info_get_nic_information (const gchar *n ifc.ifc_req = (struct ifreq *) buf; ioctl (sockfd, SIOCGIFCONF, &ifc); @@ -206,7 +212,7 @@ for (ptr = buf; ptr < buf + ifc.ifc_len;) { ifr = (struct ifreq *) ptr; -@@ -483,6 +585,45 @@ info_get_nic_information (const gchar *n +@@ -483,6 +590,45 @@ info_get_nic_information (const gchar *n (int) ((guchar *) &ifrcopy.ifr_hwaddr.sa_data)[3], (int) ((guchar *) &ifrcopy.ifr_hwaddr.sa_data)[4], (int) ((guchar *) &ifrcopy.ifr_hwaddr.sa_data)[5]); @@ -252,3 +258,12 @@ #else g_sprintf (dst, NOT_AVAILABLE); #endif /* SIOCGIFHWADDR */ +@@ -595,6 +741,8 @@ info_get_nic_information (const gchar *n + } + + freeifaddrs (ifa0); ++fail: ++ ; + } + + static gint * diff --git a/net/gnomenettool/files/patch-src_info.c b/net/gnomenettool/files/patch-src_info.c index 97015e4eb..0b8061d36 100644 --- a/net/gnomenettool/files/patch-src_info.c +++ b/net/gnomenettool/files/patch-src_info.c @@ -1,15 +1,17 @@ ---- src/info.c.orig Thu Jan 27 18:26:53 2005 -+++ src/info.c Sun Jul 3 17:46:31 2005 -@@ -20,6 +20,8 @@ +--- src/info.c.orig Mon Apr 3 15:41:33 2006 ++++ src/info.c Sun Apr 23 20:48:36 2006 +@@ -20,6 +20,10 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> #include <glib/gprintf.h> +#include <sys/types.h> +#include <string.h> ++#include <errno.h> ++#include <unistd.h> #ifdef HAVE_CONFIG_H # include <config.h> -@@ -38,6 +40,11 @@ +@@ -38,6 +42,11 @@ #include <sys/ioctl.h> #include <stdlib.h> #include <net/if.h> @@ -21,7 +23,7 @@ #include "info.h" #include "utils.h" -@@ -58,6 +65,7 @@ static InfoInterfaceDescription info_ifa +@@ -58,6 +67,7 @@ static InfoInterfaceDescription info_ifa { N_("Ethernet Interface"), INFO_INTERFACE_ETH, "16_ethernet.xpm", "eth", NULL }, { N_("Wireless Interface"), INFO_INTERFACE_WLAN, "wavelan-16.png", "wlan", NULL }, { N_("Modem Interface"), INFO_INTERFACE_PPP, "16_ppp.xpm", "ppp", NULL }, @@ -29,7 +31,7 @@ { N_("Parallel Line Interface"), INFO_INTERFACE_PLIP, "16_plip.xpm", "plip", NULL }, { N_("Infrared Interface"), INFO_INTERFACE_IRLAN, "irda-16.png", "irlan", NULL }, { N_("Loopback Interface"), INFO_INTERFACE_LO, "16_loopback.xpm", "lo", NULL }, -@@ -128,9 +136,42 @@ info_get_interface_from_dev_name (const +@@ -128,9 +138,42 @@ info_get_interface_from_dev_name (const { gint i; gchar *path; @@ -74,7 +76,7 @@ (*iface) = g_strdup_printf ("%s (%s)", _(info_iface_desc[i].name), dev_name); if (info_iface_desc[i].pixbuf == NULL) { path = g_build_filename (PIXMAPS_DIR, info_iface_desc[i].icon, NULL); -@@ -217,38 +258,87 @@ info_nic_update_stats (gpointer data) +@@ -217,38 +260,87 @@ info_nic_update_stats (gpointer data) gchar tx[10], tx_error[10], tx_drop[10], tx_ovr[10]; */ gchar iface[30]; /*, flags[30]; */ @@ -168,7 +170,7 @@ if (g_ascii_strcasecmp (iface, text) == 0) { /* -@@ -276,7 +366,9 @@ info_nic_update_stats (gpointer data) +@@ -276,7 +368,9 @@ info_nic_update_stats (gpointer data) } g_io_channel_unref (io); @@ -179,7 +181,7 @@ return TRUE; } -@@ -405,8 +497,16 @@ info_get_nic_information (const gchar *n +@@ -405,8 +499,19 @@ info_get_nic_information (const gchar *n InfoIpAddr *ip; gint flags; mii_data_result data; @@ -191,12 +193,16 @@ + struct sockaddr_dl *hwsinptr; +#endif - getifaddrs (&ifa0); +- getifaddrs (&ifa0); ++ if (getifaddrs (&ifa0) != 0) { ++ g_warning ("getifaddrs failed: %s", g_strerror (errno)); ++ goto fail; ++ } + memset (&data, 0, sizeof (data)); for (ifr6 = ifa0; ifr6; ifr6 = ifr6->ifa_next) { if (strcmp (ifr6->ifa_name, nic) != 0) { -@@ -452,7 +552,9 @@ info_get_nic_information (const gchar *n +@@ -452,7 +557,9 @@ info_get_nic_information (const gchar *n ifc.ifc_req = (struct ifreq *) buf; ioctl (sockfd, SIOCGIFCONF, &ifc); @@ -206,7 +212,7 @@ for (ptr = buf; ptr < buf + ifc.ifc_len;) { ifr = (struct ifreq *) ptr; -@@ -483,6 +585,45 @@ info_get_nic_information (const gchar *n +@@ -483,6 +590,45 @@ info_get_nic_information (const gchar *n (int) ((guchar *) &ifrcopy.ifr_hwaddr.sa_data)[3], (int) ((guchar *) &ifrcopy.ifr_hwaddr.sa_data)[4], (int) ((guchar *) &ifrcopy.ifr_hwaddr.sa_data)[5]); @@ -252,3 +258,12 @@ #else g_sprintf (dst, NOT_AVAILABLE); #endif /* SIOCGIFHWADDR */ +@@ -595,6 +741,8 @@ info_get_nic_information (const gchar *n + } + + freeifaddrs (ifa0); ++fail: ++ ; + } + + static gint * |