aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorChris Maynard <Christopher.Maynard@GTECH.COM>2013-12-12 18:10:08 +0000
committerChris Maynard <Christopher.Maynard@GTECH.COM>2013-12-12 18:10:08 +0000
commita97a3152b07b213a75e6a458e7762a0bc9284193 (patch)
treed52982e4d9e4275adb1004a62f3ad71e0af6e1f3 /epan
parent74b58162d70994797401b791c0e833ac000110f2 (diff)
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
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-h264.c23
-rw-r--r--epan/dissectors/packet-h450.c37
-rw-r--r--epan/dissectors/packet-h460.c21
3 files changed, 54 insertions, 27 deletions
diff --git a/epan/dissectors/packet-h264.c b/epan/dissectors/packet-h264.c
index 01b287df62..1e39a27689 100644
--- a/epan/dissectors/packet-h264.c
+++ b/epan/dissectors/packet-h264.c
@@ -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);
diff --git a/epan/dissectors/packet-h450.c b/epan/dissectors/packet-h450.c
index df9fd28104..d84ee83656 100644
--- a/epan/dissectors/packet-h450.c
+++ b/epan/dissectors/packet-h450.c
@@ -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"
};
diff --git a/epan/dissectors/packet-h460.c b/epan/dissectors/packet-h460.c
index 564339d4ce..45f610ae77 100644
--- a/epan/dissectors/packet-h460.c
+++ b/epan/dissectors/packet-h460.c
@@ -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;