It's not kosher to alloc and init a GArray ourselves instead of calling g_array_new().

Fixes Bug #7138 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7138)

A puzzle: why did the buildbot fuzz-testing only start failing on this on 04/18/2012
          since the bug has existed for quite some time ?

svn path=/trunk/; revision=42200
This commit is contained in:
Bill Meier 2012-04-23 01:36:57 +00:00
parent d43f0fc80a
commit c1d8dfccb9
1 changed files with 8 additions and 3 deletions

View File

@ -180,9 +180,7 @@ typedef struct _proto_avp_t {
static const char* simple_avp(diam_ctx_t*, diam_avp_t*, tvbuff_t*);
static const value_string no_vs[] = {{0, NULL} };
static GArray no_garr = { (void*)no_vs, 0 };
static diam_vnd_t unknown_vendor = { 0xffffffff, &no_garr, NULL, &no_garr };
static diam_vnd_t unknown_vendor = { 0xffffffff, NULL, NULL, NULL };
static diam_vnd_t no_vnd = { 0, NULL, NULL, NULL };
static diam_avp_t unknown_avp = {0, &unknown_vendor, simple_avp, simple_avp, -1, -1, NULL };
static GArray* all_cmds;
@ -1391,6 +1389,11 @@ strcase_equal(gconstpointer ka, gconstpointer kb)
}
/* Note: Dynamic "value string arrays" (e.g., vs_cmds, vs_avps, ...) are constructed using */
/* "zero-terminated" GArrays so that they will have the same form as standard */
/* value_string arrays created at compile time. Since the last entry in a */
/* value_string array must be {0, NULL}, we are assuming that NULL == 0 (hackish). */
static int
dictionary_load(void)
{
@ -1418,6 +1421,8 @@ dictionary_load(void)
dictionary.vnds = pe_tree_create(EMEM_TREE_TYPE_RED_BLACK,"diameter_vnds");
dictionary.avps = pe_tree_create(EMEM_TREE_TYPE_RED_BLACK,"diameter_avps");
unknown_vendor.vs_cmds = g_array_new(TRUE,TRUE,sizeof(value_string));
unknown_vendor.vs_avps = g_array_new(TRUE,TRUE,sizeof(value_string));
no_vnd.vs_cmds = g_array_new(TRUE,TRUE,sizeof(value_string));
no_vnd.vs_avps = g_array_new(TRUE,TRUE,sizeof(value_string));