aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss@ulticom.com>2012-03-19 17:12:04 +0000
committerJeff Morriss <jeff.morriss@ulticom.com>2012-03-19 17:12:04 +0000
commitc07876603f40e762ecb6b8a47e11c738cabbf509 (patch)
treed4ff587f44a7d3f9fd1ad0e30c3717e9363ba3cf /epan
parent81bc7b28aad696b8f20028f706501276b820a4ea (diff)
Fix crash (caused by a corrupted Diameter dictionary) reported in
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6664 : Add some sanity checks before adding types, vendors, commands, and AVPs. svn path=/trunk/; revision=41675
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-diameter.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c
index 0f2c6776fc..d546ace198 100644
--- a/epan/dissectors/packet-diameter.c
+++ b/epan/dissectors/packet-diameter.c
@@ -1300,7 +1300,7 @@ build_simple_avp(const avp_type_t* type, guint32 code, const diam_vnd_t* vendor,
break;
default:
- fprintf(stderr,"Diameter Dictionary: AVP %s has a list of values but isn't of a 32-bit or shorter integral type\n",
+ fprintf(stderr,"Diameter Dictionary: AVP '%s' has a list of values but isn't of a 32-bit or shorter integral type\n",
name);
return NULL;
}
@@ -1444,6 +1444,13 @@ dictionary_load(void)
const avp_type_t* parent = NULL;
/* try to get the parent type */
+ if (t->name == NULL) {
+ fprintf(stderr,"Diameter Dictionary: Invalid Type (empty name): parent==%s\n",
+ t->parent ? t->parent : "(null)");
+ continue;
+ }
+
+
if (g_hash_table_lookup(build_dict.types,t->name))
continue;
@@ -1474,6 +1481,11 @@ dictionary_load(void)
for ( ; v; v = v->next) {
value_string item = {v->code,v->name};
+ if (v->name == NULL) {
+ fprintf(stderr,"Diameter Dictionary: Invalid Vendor (empty name): code==%d\n",v->code);
+ continue;
+ }
+
if (g_hash_table_lookup(vendors,v->name))
continue;
@@ -1494,13 +1506,19 @@ dictionary_load(void)
if ((c = d->cmds)) {
for (; c; c = c->next) {
+ if (c->vendor == NULL) {
+ fprintf(stderr,"Diameter Dictionary: Invalid Vendor (empty name) for command %s\n",
+ c->name ? c->name : "(null)");
+ continue;
+ }
+
if ((vnd = g_hash_table_lookup(vendors,c->vendor))) {
value_string item = {c->code,c->name};
g_array_append_val(vnd->vs_cmds,item);
/* Also add to all_cmds as used by RFC version */
g_array_append_val(all_cmds,item);
} else {
- fprintf(stderr,"Diameter Dictionary: No Vendor: %s",c->vendor);
+ fprintf(stderr,"Diameter Dictionary: No Vendor: %s\n",c->vendor);
}
}
}
@@ -1513,11 +1531,16 @@ dictionary_load(void)
ddict_xmlpi_t* x;
void* avp_data = NULL;
+ if (a->name == NULL) {
+ fprintf(stderr,"Diameter Dictionary: Invalid AVP (empty name)\n");
+ continue;
+ }
+
if ((vnd = g_hash_table_lookup(vendors,vend))) {
value_string vndvs = {a->code,a->name};
g_array_append_val(vnd->vs_avps,vndvs);
} else {
- fprintf(stderr,"Diameter Dictionary: No Vendor: %s",vend);
+ fprintf(stderr,"Diameter Dictionary: No Vendor: %s\n",vend);
vnd = &unknown_vendor;
}