Wireshark-bugs: [Wireshark-bugs] [Bug 3069] New: g_array_append_val should not acdept pointer as

Date: Mon, 17 Nov 2008 18:43:09 -0800 (PST)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3069

           Summary: g_array_append_val should not acdept pointer as argument
                    in wtap_register_encap_type
           Product: Wireshark
           Version: SVN
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Medium
         Component: Wireshark
        AssignedTo: wireshark-bugs@xxxxxxxxxxxxx
        ReportedBy: yamisoe@xxxxxxxxx


Build Information:
Version 1.1.2 (SVN Rev 26800)

Copyright 1998-2008 Gerald Combs <gerald@xxxxxxxxxxxxx> and contributors.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiled with GTK+ 2.12.9, with GLib 2.16.3, with libpcap 0.9.8, with libz
1.2.3.3, with POSIX capabilities (Linux), with libpcre 7.4, without SMI,
without
c-ares, with ADNS, without Lua, with GnuTLS 2.0.4, with Gcrypt 1.2.4, with MIT
Kerberos, without GeoIP, with PortAudio <= V18, without AirPcap.

Running on Linux 2.6.24-16-generic, with libpcap version 0.9.8.

Built using gcc 4.2.3 (Ubuntu 4.2.3-2ubuntu7).

Wireshark is Open Source Software released under the GNU General Public
License.

Check the man page and http://www.wireshark.org for more information.
--
The code in wiretap/wtap.c is not right:

int wtap_register_encap_type(char* name, char* short_name) {
        struct encap_type_info* e = g_malloc(sizeof(struct encap_type_info));

        wtap_init_encap_types();

        e->name = g_strdup(name);
        e->short_name = g_strdup(short_name);

        g_array_append_val(encap_table_arr,e);

        encap_table = (void*)encap_table_arr->data;
        return wtap_num_encap_types++;
}


Because g_array_append_val should accept a value of type 'struct
encap_type_info' rather than a pointer to this type.

===============

BTW, is it better to replace WTAP_NUM_ENCAP_TYPES with wtap_num_encap_types in
wtap.c? Because WTAP_NUM_ENCAP_TYPES looks more like a constant.


-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.