aboutsummaryrefslogtreecommitdiffstats
path: root/asn1/h248
diff options
context:
space:
mode:
authorLuis Ontanon <luis.ontanon@gmail.com>2005-12-07 21:08:51 +0000
committerLuis Ontanon <luis.ontanon@gmail.com>2005-12-07 21:08:51 +0000
commit55d5c5cc6649c58e27d9441d3161b72a391af82d (patch)
tree632d5ade2e85983b61e1919242205238038d324d /asn1/h248
parentf65a00b5f40af5af24ce953284769e1d57602a26 (diff)
Avoid dereferencing pointers to the message, context and transaction object if they have not been created.
svn path=/trunk/; revision=16725
Diffstat (limited to 'asn1/h248')
-rw-r--r--asn1/h248/packet-h248-template.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/asn1/h248/packet-h248-template.c b/asn1/h248/packet-h248-template.c
index e7a100f189..f997767fbe 100644
--- a/asn1/h248/packet-h248-template.c
+++ b/asn1/h248/packet-h248-template.c
@@ -945,6 +945,8 @@ static h248_msg_t* h248_msg(packet_info* pinfo, int offset) {
static h248_trx_t* h248_trx(h248_msg_t* m ,guint32 t_id , h248_trx_type_t type) {
h248_trx_t* t = NULL;
h248_trx_msg_t* trxmsg;
+
+ if ( !m ) return NULL;
if (keep_persistent_data) {
if (m->commited) {
@@ -1013,6 +1015,8 @@ static h248_ctx_t* h248_ctx(h248_msg_t* m, h248_trx_t* t, guint32 c_id) {
h248_ctx_t* context = NULL;
h248_ctx_t** context_p = NULL;
+ if ( !m || !t ) return NULL;
+
if (keep_persistent_data) {
if (m->commited) {
gchar* key = ep_strdup_printf("%s:%.8x",m->addr_label,c_id);
@@ -1046,6 +1050,7 @@ static h248_ctx_t* h248_ctx(h248_msg_t* m, h248_trx_t* t, guint32 c_id) {
}
} else {
gchar* key = ep_strdup_printf("C%s:%.8x",m->addr_label,c_id);
+
if (( context = g_hash_table_lookup(ctxs_by_trx,t->key) )) {
if (( context_p = g_hash_table_lookup(ctxs,key) )) {
@@ -1108,6 +1113,8 @@ static h248_cmd_t* h248_cmd(h248_msg_t* m, h248_trx_t* t, h248_ctx_t* c, h248_cm
h248_cmd_msg_t* cmdtrx;
h248_cmd_msg_t* cmdctx;
+ if ( !m || !t || !c) return NULL;
+
if (keep_persistent_data) {
if (m->commited) {
DISSECTOR_ASSERT(t->cmds != NULL);
@@ -1172,6 +1179,8 @@ static h248_cmd_t* h248_cmd(h248_msg_t* m, h248_trx_t* t, h248_ctx_t* c, h248_cm
static void h248_cmd_add_term(h248_cmd_t* c, h248_term_t* t) {
h248_terms_t* ct;
+ if ( !c ) return;
+
if (keep_persistent_data) {
if ( c->msg->commited ) {
return;
@@ -1214,6 +1223,8 @@ static gchar* h248_cmd_to_str(h248_cmd_t* c) {
gchar* s = "-";
h248_terms_t* term;
+ if ( !c ) return "-";
+
switch (c->type) {
case H248_CMD_NONE:
return "-";
@@ -1295,6 +1306,9 @@ static gchar* h248_cmd_to_str(h248_cmd_t* c) {
static gchar* h248_trx_to_str(h248_msg_t* m, h248_trx_t* t) {
gchar* s = ep_strdup_printf("T %x { ",t->id);
h248_cmd_msg_t* c;
+
+ if ( !m || !t ) return "-";
+
if (t->cmds) {
if (t->cmds->cmd->ctx) {
@@ -1320,6 +1334,8 @@ static gchar* h248_msg_to_str(h248_msg_t* m) {
h248_trx_msg_t* t;
gchar* s = "";
+ if ( !m ) return "-";
+
for (t = m->trxs; t; t = t->next) {
s = ep_strdup_printf("%s %s",s,h248_trx_to_str(m,t->trx));
};
@@ -1340,6 +1356,7 @@ static void analyze_h248_msg(h248_msg_t* m) {
h248_ctxs_t* ctx_node;
h248_cmd_msg_t* c;
+
for (t = m->trxs; t; t = t->next) {
for (c = t->trx->cmds; c; c = c->next) {
h248_ctx_t* ctx = c->cmd->ctx;