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 static int
dissect_h450_arg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { dissect_h450_arg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
proto_item *hidden_item; proto_item *hidden_item;
int offset; int offset = 0;
rose_ctx_t *rctx = get_rose_ctx(data); rose_ctx_t *rctx;
gint32 opcode; gint32 opcode;
const h450_op_t *op_ptr; const h450_op_t *op_ptr;
const gchar *p; 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); DISSECTOR_ASSERT(rctx);
if (rctx->d.pdu != 1) /* invoke */ if (rctx->d.pdu != 1) /* invoke */
return offset; return offset;
if (rctx->d.code != 0) /* local */ 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 static int
dissect_h450_res(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { dissect_h450_res(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
proto_item *hidden_item; proto_item *hidden_item;
int offset; int offset = 0;
rose_ctx_t *rctx = get_rose_ctx(data); rose_ctx_t *rctx;
gint32 opcode; gint32 opcode;
const h450_op_t *op_ptr; const h450_op_t *op_ptr;
const gchar *p; 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); DISSECTOR_ASSERT(rctx);
if (rctx->d.pdu != 2) /* returnResult */ if (rctx->d.pdu != 2) /* returnResult */
return offset; return offset;
if (rctx->d.code != 0) /* local */ 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 static int
dissect_h450_err(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { dissect_h450_err(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
proto_item *hidden_item; proto_item *hidden_item;
int offset; int offset = 0;
rose_ctx_t *rctx = get_rose_ctx(data); rose_ctx_t *rctx;
gint32 errcode; gint32 errcode;
const h450_err_t *err_ptr; const h450_err_t *err_ptr;
const gchar *p; 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); DISSECTOR_ASSERT(rctx);
if (rctx->d.pdu != 3) /* returnError */ if (rctx->d.pdu != 3) /* returnError */
return offset; return offset;
if (rctx->d.code != 0) /* local */ if (rctx->d.code != 0) /* local */

View File

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

View File

@ -2017,13 +2017,17 @@ static const value_string h264_par_level_values[] = {
}; };
static int 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; int offset = 0;
guint16 lvl; guint16 lvl;
const gchar *p; 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); DISSECTOR_ASSERT(actx);
lvl = tvb_get_ntohs(tvb, offset); 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 static int
dissect_h264_par_DecoderConfigurationInformation(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) 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); DISSECTOR_ASSERT(actx);
dissect_h264_nal_unit(tvb, pinfo, tree); dissect_h264_nal_unit(tvb, pinfo, tree);
@ -2087,11 +2095,16 @@ static h264_capability_t *find_cap(const gchar *id) {
} }
static int 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); DISSECTOR_ASSERT(actx);
if (tree) { if (tree) {
h264_capability_t *ftr; h264_capability_t *ftr;
ftr = find_cap(pinfo->match_string); ftr = find_cap(pinfo->match_string);

View File

@ -4711,15 +4711,18 @@ static const h450_err_t *get_err(gint32 errcode) {
static int static int
dissect_h450_arg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { dissect_h450_arg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
proto_item *hidden_item; proto_item *hidden_item;
int offset; int offset = 0;
rose_ctx_t *rctx = get_rose_ctx(data); rose_ctx_t *rctx;
gint32 opcode; gint32 opcode;
const h450_op_t *op_ptr; const h450_op_t *op_ptr;
const gchar *p; 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); DISSECTOR_ASSERT(rctx);
if (rctx->d.pdu != 1) /* invoke */ if (rctx->d.pdu != 1) /* invoke */
return offset; return offset;
if (rctx->d.code != 0) /* local */ 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 static int
dissect_h450_res(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { dissect_h450_res(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
proto_item *hidden_item; proto_item *hidden_item;
int offset; int offset = 0;
rose_ctx_t *rctx = get_rose_ctx(data); rose_ctx_t *rctx;
gint32 opcode; gint32 opcode;
const h450_op_t *op_ptr; const h450_op_t *op_ptr;
const gchar *p; 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); DISSECTOR_ASSERT(rctx);
if (rctx->d.pdu != 2) /* returnResult */ if (rctx->d.pdu != 2) /* returnResult */
return offset; return offset;
if (rctx->d.code != 0) /* local */ 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 static int
dissect_h450_err(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { dissect_h450_err(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) {
proto_item *hidden_item; proto_item *hidden_item;
int offset; int offset = 0;
rose_ctx_t *rctx = get_rose_ctx(data); rose_ctx_t *rctx;
gint32 errcode; gint32 errcode;
const h450_err_t *err_ptr; const h450_err_t *err_ptr;
const gchar *p; 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); DISSECTOR_ASSERT(rctx);
if (rctx->d.pdu != 3) /* returnError */ if (rctx->d.pdu != 3) /* returnError */
return offset; return offset;
if (rctx->d.code != 0) /* local */ if (rctx->d.code != 0) /* local */
@ -6277,7 +6286,7 @@ void proto_register_h450(void) {
NULL, HFILL }}, NULL, HFILL }},
/*--- End of included file: packet-h450-hfarr.c ---*/ /*--- 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 */ /* List of subtrees */
@ -6457,7 +6466,7 @@ void proto_register_h450(void) {
&ett_h450_12_FeatureControl, &ett_h450_12_FeatureControl,
/*--- End of included file: packet-h450-ettarr.c ---*/ /*--- 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" #line 53 "../../asn1/h460/packet-h460-template.c"
/* Subdissectors */ /* Subdissectors */
static dissector_handle_t q931_ie_handle = NULL; static dissector_handle_t q931_ie_handle = NULL;
static dissector_handle_t h225_ras_handle = NULL; static dissector_handle_t h225_ras_handle = NULL;
/*--- Included file: packet-h460-fn.c ---*/ /*--- 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; return offset;
} }
static int static int
dissect_ras(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { dissect_ras(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
int offset = 0; 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", "ipsecSecurityProtocol", NULL, FFILL },
{ GD|FD, "22/2/1", "priority", NULL, FFILL }, { GD|FD, "22/2/1", "priority", NULL, FFILL },
{ 0, NULL, NULL, NULL, FFILL }, { 0, NULL, NULL, NULL, FFILL },
}; };
static h460_feature_t *find_ftr(const gchar *key) { static h460_feature_t *find_ftr(const gchar *key) {
h460_feature_t *ftr = NULL; h460_feature_t *ftr = NULL;
@ -2133,10 +2133,15 @@ static h460_feature_t *find_ftr(const gchar *key) {
static int static int
dissect_h460_name(tvbuff_t *tvb _U_, packet_info *pinfo, proto_tree *tree, void *data) { dissect_h460_name(tvbuff_t *tvb _U_, packet_info *pinfo, proto_tree *tree, void *data) {
int offset = 0; int offset = 0;
asn1_ctx_t *actx = get_asn1_ctx(data); asn1_ctx_t *actx;
h460_feature_t *ftr; h460_feature_t *ftr;
/* Reject the packet if data is NULL */
if (data == NULL)
return 0;
actx = get_asn1_ctx(data);
DISSECTOR_ASSERT(actx); DISSECTOR_ASSERT(actx);
if (tree) { if (tree) {
/* DEBUG */ /*proto_tree_add_text(tree, tvb, 0, 0, "*** DEBUG dissect_h460_name: %s", pinfo->match_string);*/ /* DEBUG */ /*proto_tree_add_text(tree, tvb, 0, 0, "*** DEBUG dissect_h460_name: %s", pinfo->match_string);*/
ftr = find_ftr(pinfo->match_string); ftr = find_ftr(pinfo->match_string);
@ -2873,7 +2878,7 @@ void proto_register_h460(void) {
"UnicastAddress", HFILL }}, "UnicastAddress", HFILL }},
/*--- End of included file: packet-h460-hfarr.c ---*/ /*--- 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 */ /* List of subtrees */
@ -2972,7 +2977,7 @@ void proto_register_h460(void) {
&ett_h460_21_TransmitCapabilities, &ett_h460_21_TransmitCapabilities,
/*--- End of included file: packet-h460-ettarr.c ---*/ /*--- 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 */ /* Register protocol */
@ -2992,7 +2997,7 @@ void proto_register_h460(void) {
} }
/*--- proto_reg_handoff_h460 -------------------------------------------*/ /*--- proto_reg_handoff_h460 -------------------------------------------*/
void proto_reg_handoff_h460(void) void proto_reg_handoff_h460(void)
{ {
h460_feature_t *ftr; h460_feature_t *ftr;
dissector_handle_t h460_name_handle; dissector_handle_t h460_name_handle;