[gnome-control-center] network: don't crash on hidden SSIDs



commit 8631717b3d1cb85bf21b0e0d648b784e8e7c3f8f
Author: Dan Williams <dcbw redhat com>
Date:   Fri Apr 20 11:48:17 2012 -0500

    network: don't crash on hidden SSIDs
    
    APs that don't broadcast their SSID will return NULL from
    nm_access_point_get_ssid() (since that's easier to check in C
    using an if statement than returning a zero-length GByteArray).
    Thus the code shouldn't try to dereference the SSID byte array
    since it could be NULL.
    
    But in fact, the panel shouldn't be showing hidden APs anywhere
    in the UI, since the user needs to manually enter the SSID to
    connect to it anyway.  So just ignore hidden APs like nm-applet
    does.
    
    Signed-off-by: Dan Williams <dcbw redhat com>
    Signed-off-by: Richard Hughes <richard hughsie com>

 panels/network/cc-network-panel.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index c8cbd78..d5ab951 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -1124,13 +1124,19 @@ panel_get_strongest_unique_aps (const GPtrArray *aps)
         if (aps != NULL)
                 for (i = 0; i < aps->len; i++) {
                         ap = NM_ACCESS_POINT (g_ptr_array_index (aps, i));
+
+                        /* Hidden SSIDs don't get shown in the list */
                         ssid = nm_access_point_get_ssid (ap);
+                        if (!ssid)
+                                continue;
+
                         add_ap = TRUE;
 
                         /* get already added list */
                         for (j=0; j<aps_unique->len; j++) {
                                 ap_tmp = NM_ACCESS_POINT (g_ptr_array_index (aps_unique, j));
                                 ssid_tmp = nm_access_point_get_ssid (ap_tmp);
+                                g_assert (ssid_tmp);
         
                                 /* is this the same type and data? */
                                 if (nm_utils_same_ssid (ssid, ssid_tmp, TRUE)) {



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