diff options
author | Chris Maynard <Christopher.Maynard@GTECH.COM> | 2013-12-12 19:04:38 +0000 |
---|---|---|
committer | Chris Maynard <Christopher.Maynard@GTECH.COM> | 2013-12-12 19:04:38 +0000 |
commit | 4b609d4c9204dfd2814e5a63dfe79eb00cbf37b3 (patch) | |
tree | f821ea40bbaa6752a10ec1d3ac618cc2afd16df2 /asn1/isdn-sup/packet-isdn-sup-template.c | |
parent | a97a3152b07b213a75e6a458e7762a0bc9284193 (diff) |
Reject the packet if data is NULL. For now, leave the DISSECTOR_ASSERT's since both get_rose_ctx() and get_asn1_ctx() also check signatures.
svn path=/trunk/; revision=53965
Diffstat (limited to 'asn1/isdn-sup/packet-isdn-sup-template.c')
-rw-r--r-- | asn1/isdn-sup/packet-isdn-sup-template.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/asn1/isdn-sup/packet-isdn-sup-template.c b/asn1/isdn-sup/packet-isdn-sup-template.c index 94a75fe683..39ac070c52 100644 --- a/asn1/isdn-sup/packet-isdn-sup-template.c +++ b/asn1/isdn-sup/packet-isdn-sup-template.c @@ -138,17 +138,20 @@ static const isdn_sup_err_t *get_err(gint32 errcode) { /*--- dissect_isdn_sup_arg ------------------------------------------------------*/ static int dissect_isdn_sup_arg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { - int offset; - rose_ctx_t *rctx = get_rose_ctx(data); + int offset = 0; + rose_ctx_t *rctx; gint32 opcode = 0; const gchar *p; const isdn_sup_op_t *op_ptr; proto_item *ti; proto_tree *isdn_sup_tree; - offset = 0; - + /* Reject the packet if data is NULL */ + if (data == NULL) + return 0; + rctx = get_rose_ctx(data); DISSECTOR_ASSERT(rctx); + if (rctx->d.pdu != 1) /* invoke */ return offset; if (rctx->d.code == 0) { /* local */ @@ -186,17 +189,20 @@ dissect_isdn_sup_arg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * /*--- dissect_isdn_sup_res -------------------------------------------------------*/ static int dissect_isdn_sup_res(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { - gint offset; - rose_ctx_t *rctx = get_rose_ctx(data); + gint offset = 0; + rose_ctx_t *rctx; gint32 opcode = 0; const gchar *p; const isdn_sup_op_t *op_ptr; proto_item *ti; proto_tree *isdn_sup_tree; - offset = 0; - + /* Reject the packet if data is NULL */ + if (data == NULL) + return 0; + rctx = get_rose_ctx(data); DISSECTOR_ASSERT(rctx); + if (rctx->d.pdu != 2) /* returnResult */ return offset; if (rctx->d.code != 0) /* local */ @@ -233,17 +239,20 @@ dissect_isdn_sup_res(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * /*--- dissect_isdn_sup_err ------------------------------------------------------*/ static int dissect_isdn_sup_err(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { - int offset; - rose_ctx_t *rctx = get_rose_ctx(data); + int offset = 0; + rose_ctx_t *rctx; gint32 errcode; const isdn_sup_err_t *err_ptr; const gchar *p; proto_item *ti; proto_tree *isdn_sup_tree; - offset = 0; - + /* Reject the packet if data is NULL */ + if (data == NULL) + return 0; + rctx = get_rose_ctx(data); DISSECTOR_ASSERT(rctx); + if (rctx->d.pdu != 3) /* returnError */ return offset; if (rctx->d.code != 0) /* local */ |