aboutsummaryrefslogtreecommitdiffstats
path: root/asn1/tcap
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2007-09-13 20:20:11 +0000
committerAnders Broman <anders.broman@ericsson.com>2007-09-13 20:20:11 +0000
commit30e64dade479cb3f1455299580575d44c900ac8d (patch)
treeabcb17a5d4c6650c2b2dfeb81ac6a0df7e04d37a /asn1/tcap
parentd582da8fcdf003685087c349736d680f9fd6e2bb (diff)
Try to protect the hash table...
svn path=/trunk/; revision=22866
Diffstat (limited to 'asn1/tcap')
-rw-r--r--asn1/tcap/ansi_tcap.cnf3
-rw-r--r--asn1/tcap/packet-ansi_tcap-template.c19
2 files changed, 15 insertions, 7 deletions
diff --git a/asn1/tcap/ansi_tcap.cnf b/asn1/tcap/ansi_tcap.cnf
index 0c88f693e9..3c4c01e029 100644
--- a/asn1/tcap/ansi_tcap.cnf
+++ b/asn1/tcap/ansi_tcap.cnf
@@ -119,7 +119,8 @@ guint8 len;
%(DEFAULT_BODY)s
if(next_tvb) {
- ansi_tcap_private.TransactionID_str = tvb_bytes_to_str(next_tvb, 0,tvb_length(next_tvb));
+ if(tvb_length(next_tvb) !=0)
+ ansi_tcap_private.TransactionID_str = tvb_bytes_to_str(next_tvb, 0,tvb_length(next_tvb));
len = tvb_length_remaining(next_tvb, 0);
switch(len) {
case 1:
diff --git a/asn1/tcap/packet-ansi_tcap-template.c b/asn1/tcap/packet-ansi_tcap-template.c
index 8fa9c55ce7..d8794662a0 100644
--- a/asn1/tcap/packet-ansi_tcap-template.c
+++ b/asn1/tcap/packet-ansi_tcap-template.c
@@ -102,6 +102,7 @@ static void ansi_tcap_ctx_init(struct ansi_tcap_private_t *a_tcap_ctx) {
memset(a_tcap_ctx, '\0', sizeof(*a_tcap_ctx));
a_tcap_ctx->signature = ANSI_TCAP_CTX_SIGNATURE;
a_tcap_ctx->oid_is_present = FALSE;
+ a_tcap_ctx->TransactionID_str = NULL;
}
static void dissect_ansi_tcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree);
@@ -193,17 +194,23 @@ save_invoke_data(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb _U_){
if ((!pinfo->fd->flags.visited)&&(ansi_tcap_private.TransactionID_str)){
/* Only do this once XXX I hope its the right thing to do */
- ansi_tcap_saved_invokedata = g_malloc(sizeof(ansi_tcap_saved_invokedata));
- ansi_tcap_saved_invokedata->OperationCode = ansi_tcap_private.d.OperationCode;
-
- ansi_tcap_saved_invokedata->OperationCode_national = ansi_tcap_private.d.OperationCode_national;
- ansi_tcap_saved_invokedata->OperationCode_private = ansi_tcap_private.d.OperationCode_private;
-
+ g_warning("Trans id=%s",ansi_tcap_private.TransactionID_str);
strcpy(buf, ansi_tcap_private.TransactionID_str);
/* The hash string needs to contain src and dest to distiguish differnt flows */
strcat(buf,src_str);
strcat(buf,dst_str);
strcat(buf,"\0");
+
+ /* If the entry allready exists don't owervrite it */
+ ansi_tcap_saved_invokedata = g_hash_table_lookup(TransactionId_table,buf);
+ if(ansi_tcap_saved_invokedata)
+ return;
+
+ ansi_tcap_saved_invokedata = g_malloc(sizeof(ansi_tcap_saved_invokedata));
+ ansi_tcap_saved_invokedata->OperationCode = ansi_tcap_private.d.OperationCode;
+ ansi_tcap_saved_invokedata->OperationCode_national = ansi_tcap_private.d.OperationCode_national;
+ ansi_tcap_saved_invokedata->OperationCode_private = ansi_tcap_private.d.OperationCode_private;
+
g_hash_table_insert(TransactionId_table,
g_strdup(buf),
ansi_tcap_saved_invokedata);