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

@ -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);

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

@ -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 */