aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/asn1
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2009-08-03 23:49:05 +0000
committerGerald Combs <gerald@wireshark.org>2009-08-03 23:49:05 +0000
commit5bbd3046010c3e8a1d9925ff99a286b12754748e (patch)
treeb79f3b388ac3b2f20e08ea699fbf0a869c35e781 /plugins/asn1
parent42a4efbb59172d811c9efe5099fb94ab683fe650 (diff)
Add some null checks.
svn path=/trunk/; revision=29285
Diffstat (limited to 'plugins/asn1')
-rw-r--r--plugins/asn1/packet-asn1.c46
1 files changed, 45 insertions, 1 deletions
diff --git a/plugins/asn1/packet-asn1.c b/plugins/asn1/packet-asn1.c
index cb179f3307..1ed411a457 100644
--- a/plugins/asn1/packet-asn1.c
+++ b/plugins/asn1/packet-asn1.c
@@ -2228,9 +2228,17 @@ define_constraint(GNode *p, GNode *q)
p = g_node_first_child(p);
+ if (!p) {
+ return;
+ }
+
range->from = get_asn1_int(0, GPOINTER_TO_UINT(p->data));
p = g_node_next_sibling(p);
+ if (!p) {
+ return;
+ }
+
range->to = get_asn1_int(1, GPOINTER_TO_UINT(p->data));
}
@@ -2246,10 +2254,18 @@ define_namednumber(GNode *p, GNode *q)
/* g_message("define_namednumber %p, %p", p, q); */
p = g_node_first_child(p);
+
+ if (!p) {
+ return;
+ }
num->name = get_asn1_string(0, GPOINTER_TO_UINT(p->data));
p = g_node_next_sibling(p);
+ if (!p) {
+ return;
+ }
+
num->value = get_asn1_int(1, GPOINTER_TO_UINT(p->data));
}
@@ -2265,9 +2281,17 @@ define_typeref(GNode *p, GNode *q)
p = g_node_first_child(p);
+ if (!p) {
+ return;
+ }
+
ref->typeDefId = get_asn1_uint(GPOINTER_TO_UINT(p->data));
p = g_node_next_sibling(p);
+ if (!p) {
+ return;
+ }
+
ref->implicit = get_asn1_int(BER_UNI_TAG_BOOLEAN, GPOINTER_TO_UINT(p->data));
}
@@ -2283,9 +2307,17 @@ define_tag(GNode *p, GNode *q)
p = g_node_first_child(p);
+ if (!p) {
+ return;
+ }
+
type->tclass = get_asn1_int(BER_UNI_TAG_ENUMERATED, GPOINTER_TO_UINT(p->data));
p = g_node_next_sibling(p);
+ if (!p) {
+ return;
+ }
+
type->code = get_asn1_int(BER_UNI_TAG_INTEGER, GPOINTER_TO_UINT(p->data));
}
@@ -2383,12 +2415,24 @@ define_typedef(GNode *p, GNode *q)
p = g_node_first_child(p);
+ if (!p) {
+ return;
+ }
+
type_def->typeDefId = get_asn1_uint(GPOINTER_TO_UINT(p->data));
p = g_node_next_sibling(p);
+ if (!p) {
+ return;
+ }
+
type_def->typeName = get_asn1_string(BER_UNI_TAG_PrintableString, GPOINTER_TO_UINT(p->data));
p = g_node_next_sibling(p);
+ if (!p) {
+ return;
+ }
+
define_type(g_node_first_child(p), t);
p = g_node_next_sibling(p);
@@ -4071,7 +4115,7 @@ getinfo(GNode *node) {
#define NEXT {pos.node = g_node_next_sibling(pos.node);pos.type=0;}
#define CHILD {pos.node = g_node_first_child(pos.node);pos.type=0;}
-#define MATCH ((class == info->tclass) && (tag == info->tag))
+#define MATCH (info && (class == info->tclass) && (tag == info->tag))
#define ISOPTIONAL (info && (info->flags & PDU_OPTIONAL))
#define ISIMPLICIT (info && (info->flags & PDU_IMPLICIT))
#define ISREFERENCE (info && (info->flags & PDU_REFERENCE))