Commit beb5c134 authored by Will Thompson's avatar Will Thompson Committed by Zeeshan Ali

mozilla: handle wpa_bss_get_ssid() returning NULL

On my Endless OS system running 2.5.2, I see the following crash
reasonably often:

    #0  0x00007fdc12e57300 in g_bit_lock () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #1  0x00007fdc12ec38f7 in g_variant_n_children () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #2  0x00005562e11de273 in variant_to_string (variant=0x0, len=len@entry=0x0) at ../src/gclue-mozilla.c:49
            n_bytes = <optimized out>
            i = <optimized out>
            ret = <optimized out>
    #3  0x00005562e11de4f8 in get_ssid_from_bss (bss=0x5562e2c896d0) at ../src/gclue-mozilla.c:71
            variant = <optimized out>
            variant = <optimized out>
    #4  gclue_mozilla_should_ignore_bss (bss=bss@entry=0x5562e2c896d0) at ../src/gclue-mozilla.c:414
            ssid = <optimized out>
            bssid = <optimized out>
    #5  0x00005562e11ddaba in on_bss_proxy_ready (source_object=<optimized out>, res=<optimized out>, user_data=0x5562e2c7a2d0) at ../src/gclue-wifi.c:313
            wifi = 0x5562e2c7a2d0
            bss = 0x5562e2c896d0
            error = 0x0
            ssid = <optimized out>

In frame 2, 'variant' is NULL. In 2.5.2, get_ssid_from_bss looks like
this:

    static gboolean
    get_ssid_from_bss (WPABSS *bss)
    {
            GVariant *variant = wpa_bss_get_ssid (bss);

            return variant_to_string (variant, NULL);
    }

Since 2.5.2, bdaf6069 added a NULL check
to this function – which I think would fix my crash. Then
3b7a7d2a removed this NULL check again
without explanation!

It seems that, in practice, wpa_bss_get_ssid() can return NULL, so we
must handle this case.
parent 8d09d4e6
......@@ -69,6 +69,8 @@ static guint
get_ssid_from_bss (WPABSS *bss, char *ssid)
{
GVariant *variant = wpa_bss_get_ssid (bss);
if (variant == NULL)
return 0;
return variant_to_string (variant, MAX_SSID_LEN, ssid);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment