summaryrefslogtreecommitdiff
path: root/plugins/transum
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2017-02-12 12:35:46 -0500
committerMichael Mann <mmann78@netscape.net>2017-02-18 03:09:38 +0000
commit5d3d96cac4e4ad0d0e11a85e64689105cc7e53c7 (patch)
treebfe976701b553f299f2aea243a0d7289c99ccc08 /plugins/transum
parent2c3dda5126e37c36a0176e8d4df712538decf470 (diff)
downloadwireshark-5d3d96cac4e4ad0d0e11a85e64689105cc7e53c7.tar.gz
transum: Add protections against NULL trees.
proto_find_finfo doesn't have NULL tree protection, so protect it from transum dissector. Bug: 13395 Change-Id: I1037c675cf10b959f116b20b12cc7b388c175cd3 Reviewed-on: https://code.wireshark.org/review/20077 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'plugins/transum')
-rw-r--r--plugins/transum/extractors.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/plugins/transum/extractors.c b/plugins/transum/extractors.c
index 8dfd57de7b..178d0d3f27 100644
--- a/plugins/transum/extractors.c
+++ b/plugins/transum/extractors.c
@@ -36,7 +36,14 @@
*/
int extract_uint(proto_tree *tree, int field_id, guint32 *result_array, size_t *element_count)
{
- GPtrArray *finfo_array = proto_find_finfo(tree, field_id);
+ GPtrArray *finfo_array;
+
+ *element_count = 0;
+ if (tree == NULL) {
+ return -1;
+ }
+
+ finfo_array = proto_find_finfo(tree, field_id);
if (finfo_array == NULL) {
return -1;
@@ -56,7 +63,14 @@ int extract_uint(proto_tree *tree, int field_id, guint32 *result_array, size_t *
int extract_ui64(proto_tree *tree, int field_id, guint64 *result_array, size_t *element_count)
{
- GPtrArray *finfo_array = proto_find_finfo(tree, field_id);
+ GPtrArray *finfo_array;
+
+ *element_count = 0;
+ if (tree == NULL) {
+ return -1;
+ }
+
+ finfo_array = proto_find_finfo(tree, field_id);
if (finfo_array == NULL) {
return -1;
@@ -76,7 +90,14 @@ int extract_ui64(proto_tree *tree, int field_id, guint64 *result_array, size_t *
int extract_si64(proto_tree *tree, int field_id, guint64 *result_array, size_t *element_count)
{
- GPtrArray *finfo_array = proto_find_finfo(tree, field_id);
+ GPtrArray *finfo_array;
+
+ *element_count = 0;
+ if (tree == NULL) {
+ return -1;
+ }
+
+ finfo_array = proto_find_finfo(tree, field_id);
if (finfo_array == NULL) {
return -1;
@@ -96,7 +117,14 @@ int extract_si64(proto_tree *tree, int field_id, guint64 *result_array, size_t *
int extract_bool(proto_tree *tree, int field_id, gboolean *result_array, size_t *element_count)
{
- GPtrArray *finfo_array = proto_find_finfo(tree, field_id);
+ GPtrArray *finfo_array;
+
+ *element_count = 0;
+ if (tree == NULL) {
+ return -1;
+ }
+
+ finfo_array = proto_find_finfo(tree, field_id);
if (finfo_array == NULL) {
return -1;