Reject the packet if data is NULL. Remove _U_ where data is actually used. For now, leave the DISSECTOR_ASSERT's since both get_rose_ctx() and get_asn1_ctx() also check signatures.

(Arguably it's the responsibility of the dissector passing this information to set the signature correctly so if there's an invalid signature, the bug is with the calling dissector and not with the one receiving the invalid signature.)

svn path=/trunk/; revision=53964
This commit is contained in:
Chris Maynard 2013-12-12 18:10:08 +00:00
parent 74b58162d7
commit a97a3152b0
5 changed files with 86 additions and 45 deletions

View File

@ -117,15 +117,18 @@ static const h450_err_t *get_err(gint32 errcode) {
static int
dissect_h450_arg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
proto_item *hidden_item;
int offset;
rose_ctx_t *rctx = get_rose_ctx(data);
int offset = 0;
rose_ctx_t *rctx;
gint32 opcode;
const h450_op_t *op_ptr;
const gchar *p;
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 */
@ -159,15 +162,18 @@ dissect_h450_arg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
static int
dissect_h450_res(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
proto_item *hidden_item;
int offset;
rose_ctx_t *rctx = get_rose_ctx(data);
int offset = 0;
rose_ctx_t *rctx;
gint32 opcode;
const h450_op_t *op_ptr;
const gchar *p;
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 */
@ -201,15 +207,18 @@ dissect_h450_res(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
static int
dissect_h450_err(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
proto_item *hidden_item;
int offset;
rose_ctx_t *rctx = get_rose_ctx(data);
int offset = 0;
rose_ctx_t *rctx;
gint32 errcode;
const h450_err_t *err_ptr;
const gchar *p;
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 */

View File

@ -52,8 +52,8 @@ static int proto_h460 = -1;
#include "packet-h460-ett.c"
/* Subdissectors */
static dissector_handle_t q931_ie_handle = NULL;
static dissector_handle_t h225_ras_handle = NULL;
static dissector_handle_t q931_ie_handle = NULL;
static dissector_handle_t h225_ras_handle = NULL;
#include "packet-h460-fn.c"
@ -68,7 +68,7 @@ dissect_ies(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
return offset;
}
static int
static int
dissect_ras(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
int offset = 0;
@ -202,7 +202,7 @@ static h460_feature_t h460_feature_tab[] = {
{ GD|FD, "22/2", "ipsecSecurityProtocol", NULL, FFILL },
{ GD|FD, "22/2/1", "priority", NULL, FFILL },
{ 0, NULL, NULL, NULL, FFILL },
};
};
static h460_feature_t *find_ftr(const gchar *key) {
h460_feature_t *ftr = NULL;
@ -221,10 +221,15 @@ static h460_feature_t *find_ftr(const gchar *key) {
static int
dissect_h460_name(tvbuff_t *tvb _U_, packet_info *pinfo, proto_tree *tree, void *data) {
int offset = 0;
asn1_ctx_t *actx = get_asn1_ctx(data);
asn1_ctx_t *actx;
h460_feature_t *ftr;
/* Reject the packet if data is NULL */
if (data == NULL)
return 0;
actx = get_asn1_ctx(data);
DISSECTOR_ASSERT(actx);
if (tree) {
/* DEBUG */ /*proto_tree_add_text(tree, tvb, 0, 0, "*** DEBUG dissect_h460_name: %s", pinfo->match_string);*/
ftr = find_ftr(pinfo->match_string);
@ -271,7 +276,7 @@ void proto_register_h460(void) {
}
/*--- proto_reg_handoff_h460 -------------------------------------------*/
void proto_reg_handoff_h460(void)
void proto_reg_handoff_h460(void)
{
h460_feature_t *ftr;
dissector_handle_t h460_name_handle;

View File

@ -2017,13 +2017,17 @@ static const value_string h264_par_level_values[] = {
};
static int
dissect_h264_par_level(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_)
dissect_h264_par_level(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, void *data)
{
int offset = 0;
guint16 lvl;
const gchar *p;
asn1_ctx_t *actx = get_asn1_ctx(data);
asn1_ctx_t *actx;
/* Reject the packet if data is NULL */
if (data == NULL)
return 0;
actx = get_asn1_ctx(data);
DISSECTOR_ASSERT(actx);
lvl = tvb_get_ntohs(tvb, offset);
@ -2038,8 +2042,12 @@ dissect_h264_par_level(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _
static int
dissect_h264_par_DecoderConfigurationInformation(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
asn1_ctx_t *actx = get_asn1_ctx(data);
asn1_ctx_t *actx;
/* Reject the packet if data is NULL */
if (data == NULL)
return 0;
actx = get_asn1_ctx(data);
DISSECTOR_ASSERT(actx);
dissect_h264_nal_unit(tvb, pinfo, tree);
@ -2087,11 +2095,16 @@ static h264_capability_t *find_cap(const gchar *id) {
}
static int
dissect_h264_name(tvbuff_t *tvb _U_, packet_info *pinfo, proto_tree *tree, void* data _U_)
dissect_h264_name(tvbuff_t *tvb _U_, packet_info *pinfo, proto_tree *tree, void* data)
{
asn1_ctx_t *actx = get_asn1_ctx(data);
asn1_ctx_t *actx;
/* Reject the packet if data is NULL */
if (data == NULL)
return 0;
actx = get_asn1_ctx(data);
DISSECTOR_ASSERT(actx);
if (tree) {
h264_capability_t *ftr;
ftr = find_cap(pinfo->match_string);

View File

@ -4711,15 +4711,18 @@ static const h450_err_t *get_err(gint32 errcode) {
static int
dissect_h450_arg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
proto_item *hidden_item;
int offset;
rose_ctx_t *rctx = get_rose_ctx(data);
int offset = 0;
rose_ctx_t *rctx;
gint32 opcode;
const h450_op_t *op_ptr;
const gchar *p;
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 */
@ -4753,15 +4756,18 @@ dissect_h450_arg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
static int
dissect_h450_res(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
proto_item *hidden_item;
int offset;
rose_ctx_t *rctx = get_rose_ctx(data);
int offset = 0;
rose_ctx_t *rctx;
gint32 opcode;
const h450_op_t *op_ptr;
const gchar *p;
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 */
@ -4795,15 +4801,18 @@ dissect_h450_res(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
static int
dissect_h450_err(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
proto_item *hidden_item;
int offset;
rose_ctx_t *rctx = get_rose_ctx(data);
int offset = 0;
rose_ctx_t *rctx;
gint32 errcode;
const h450_err_t *err_ptr;
const gchar *p;
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 */
@ -6277,7 +6286,7 @@ void proto_register_h450(void) {
NULL, HFILL }},
/*--- End of included file: packet-h450-hfarr.c ---*/
#line 254 "../../asn1/h450/packet-h450-template.c"
#line 263 "../../asn1/h450/packet-h450-template.c"
};
/* List of subtrees */
@ -6457,7 +6466,7 @@ void proto_register_h450(void) {
&ett_h450_12_FeatureControl,
/*--- End of included file: packet-h450-ettarr.c ---*/
#line 259 "../../asn1/h450/packet-h450-template.c"
#line 268 "../../asn1/h450/packet-h450-template.c"
};

View File

@ -359,8 +359,8 @@ static gint ett_h460_21_TransmitCapabilities = -1;
#line 53 "../../asn1/h460/packet-h460-template.c"
/* Subdissectors */
static dissector_handle_t q931_ie_handle = NULL;
static dissector_handle_t h225_ras_handle = NULL;
static dissector_handle_t q931_ie_handle = NULL;
static dissector_handle_t h225_ras_handle = NULL;
/*--- Included file: packet-h460-fn.c ---*/
@ -1980,7 +1980,7 @@ dissect_ies(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
return offset;
}
static int
static int
dissect_ras(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
int offset = 0;
@ -2114,7 +2114,7 @@ static h460_feature_t h460_feature_tab[] = {
{ GD|FD, "22/2", "ipsecSecurityProtocol", NULL, FFILL },
{ GD|FD, "22/2/1", "priority", NULL, FFILL },
{ 0, NULL, NULL, NULL, FFILL },
};
};
static h460_feature_t *find_ftr(const gchar *key) {
h460_feature_t *ftr = NULL;
@ -2133,10 +2133,15 @@ static h460_feature_t *find_ftr(const gchar *key) {
static int
dissect_h460_name(tvbuff_t *tvb _U_, packet_info *pinfo, proto_tree *tree, void *data) {
int offset = 0;
asn1_ctx_t *actx = get_asn1_ctx(data);
asn1_ctx_t *actx;
h460_feature_t *ftr;
/* Reject the packet if data is NULL */
if (data == NULL)
return 0;
actx = get_asn1_ctx(data);
DISSECTOR_ASSERT(actx);
if (tree) {
/* DEBUG */ /*proto_tree_add_text(tree, tvb, 0, 0, "*** DEBUG dissect_h460_name: %s", pinfo->match_string);*/
ftr = find_ftr(pinfo->match_string);
@ -2873,7 +2878,7 @@ void proto_register_h460(void) {
"UnicastAddress", HFILL }},
/*--- End of included file: packet-h460-hfarr.c ---*/
#line 250 "../../asn1/h460/packet-h460-template.c"
#line 255 "../../asn1/h460/packet-h460-template.c"
};
/* List of subtrees */
@ -2972,7 +2977,7 @@ void proto_register_h460(void) {
&ett_h460_21_TransmitCapabilities,
/*--- End of included file: packet-h460-ettarr.c ---*/
#line 255 "../../asn1/h460/packet-h460-template.c"
#line 260 "../../asn1/h460/packet-h460-template.c"
};
/* Register protocol */
@ -2992,7 +2997,7 @@ void proto_register_h460(void) {
}
/*--- proto_reg_handoff_h460 -------------------------------------------*/
void proto_reg_handoff_h460(void)
void proto_reg_handoff_h460(void)
{
h460_feature_t *ftr;
dissector_handle_t h460_name_handle;