From 0168b71cfd6517baf7062b2fc61114f3d49b2299 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 6 Jan 2019 11:42:56 -0800 Subject: Require that dissect_atm_pw_oam_cell() be called with a non-null data pointer. The only place where it's currently called passes it data. Do a DISSECTOR_ASSERT() check to make sure it's non-null. Remove null-pointer checks that this renders no longer necessary. Change-Id: I2fc86f9591a7126d328029379ecfe98400dd01cb Reviewed-on: https://code.wireshark.org/review/31419 Reviewed-by: Guy Harris --- epan/dissectors/packet-atm.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'epan/dissectors/packet-atm.c') diff --git a/epan/dissectors/packet-atm.c b/epan/dissectors/packet-atm.c index 968ff923ca..b5c1089f9e 100644 --- a/epan/dissectors/packet-atm.c +++ b/epan/dissectors/packet-atm.c @@ -1342,9 +1342,9 @@ dissect_atm_cell_payload(tvbuff_t *tvb, int offset, packet_info *pinfo, * First check whether custom dissection table * was set up to dissect this VPI+VCI combination */ - if (atm_info && dissector_try_uint_new(atm_cell_payload_vpi_vci_table, - ((atm_info->vpi) << 16) | atm_info->vci, - next_tvb, pinfo, tree, TRUE, atm_info)) + if (dissector_try_uint_new(atm_cell_payload_vpi_vci_table, + ((atm_info->vpi) << 16) | atm_info->vci, + next_tvb, pinfo, tree, TRUE, atm_info)) { return; } @@ -1733,15 +1733,13 @@ dissect_atm_pw_oam_cell(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi { struct pw_atm_phdr *pw_atm_info = (struct pw_atm_phdr *)data; - col_set_str(pinfo->cinfo, COL_PROTOCOL, "ATM"); + DISSECTOR_ASSERT(pw_atm_info != NULL); - if (pw_atm_info) { - dissect_atm_cell_payload(tvb, 0, pinfo, tree, AAL_OAMCELL, - pw_atm_info->enable_fill_columns_by_atm_dissector, - &pw_atm_info->info); - } else { - dissect_atm_cell_payload(tvb, 0, pinfo, tree, AAL_OAMCELL, TRUE, NULL); - } + col_set_str(pinfo->cinfo, COL_PROTOCOL, "ATM"); + + dissect_atm_cell_payload(tvb, 0, pinfo, tree, AAL_OAMCELL, + pw_atm_info->enable_fill_columns_by_atm_dissector, + &pw_atm_info->info); return tvb_reported_length(tvb); } -- cgit v1.2.3