Wireshark mailing list archives

Label leakage in epan/wslua/wslua_gui.c in error path ...


From: Richard Sharpe <realrichardsharpe () gmail com>
Date: Sat, 14 Jul 2012 07:15:54 -0700

Hi folks,

In epan/wslua/wslua_gui.c, we see this:

    for (i = 1; i <= top; i++) {
        gchar* label = (void*)luaL_checkstring(L,i);

        /* XXX leaks labels on error */
        if (! label)
            WSLUA_ERROR(new_dialog,"All fields must be strings");

        g_ptr_array_add(labels,label);
    }

The obvious solution would seem to be:

    for (i = 1; i <= top; i++) {
        gchar* label = (void*)luaL_checkstring(L,i);

        /* no more leaks of labels on error */
        if (! label) {
            g_ptr_array_free(labels, FALSE);
            WSLUA_ERROR(new_dialog,"All fields must be strings");
        }

        g_ptr_array_add(labels,label);
    }


-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: