diff options
author | Chris Maynard <Christopher.Maynard@GTECH.COM> | 2012-07-13 21:32:15 +0000 |
---|---|---|
committer | Chris Maynard <Christopher.Maynard@GTECH.COM> | 2012-07-13 21:32:15 +0000 |
commit | ad3c388b4beab99295fc8b1f889d27beff79ed24 (patch) | |
tree | 4e3c3c07430e2c48d541421479a462dc123a3ec1 /epan/dissectors/packet-bssap.c | |
parent | ff63dcfa8ef615bd158744bdb56510b14b138093 (diff) |
tvb_length_remaining() can return -1, so check if its return value is <= 0 when aborting and not just == 0.
svn path=/trunk/; revision=43702
Diffstat (limited to 'epan/dissectors/packet-bssap.c')
-rw-r--r-- | epan/dissectors/packet-bssap.c | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/epan/dissectors/packet-bssap.c b/epan/dissectors/packet-bssap.c index 977cca5d3c..8ebea993ed 100644 --- a/epan/dissectors/packet-bssap.c +++ b/epan/dissectors/packet-bssap.c @@ -1660,37 +1660,37 @@ static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr offset = dissect_bssap_vlr_number(tvb, bssap_tree, offset); /* End of mandatory elements */ - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* TMSI TMSI 18.4.23 O TLV 6 */ if ( check_optional_ie(tvb, offset, BSSAP_TMSI)) offset = dissect_bssap_tmsi(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* Location area identifier Location area identifier 18.4.14 O TLV 7 */ if ( check_optional_ie(tvb, offset, BSSAP_LOC_AREA_ID)) offset = dissect_bssap_loc_area_id(tvb, bssap_tree, pinfo, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* Channel needed Channel needed 18.4.2 O TLV 3 */ if ( check_optional_ie(tvb, offset, BSSAP_CHANNEL_NEEDED)) offset = dissect_bssap_channel_needed(tvb, bssap_tree, pinfo, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* eMLPP Priority eMLPP Priority 18.4.4 O TLV 3 */ if ( check_optional_ie(tvb, offset, BSSAP_EMLPP_PRIORITY)) offset = dissect_bssap_emlpp_priority(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* Global CN-Id Global CN-Id 18.4.27 O TLV 7 */ if ( check_optional_ie(tvb, offset, BSSAP_GLOBAL_CN_ID)) offset = dissect_bssap_global_cn_id(tvb, pinfo, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); @@ -1703,7 +1703,7 @@ static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if ( check_ie(tvb, tree, &offset, BSSAP_GS_CAUSE)) offset = dissect_bssap_Gs_cause(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); break; @@ -1720,7 +1720,7 @@ static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if ( check_ie(tvb, tree, &offset, BSSAP_DLINK_TNL_PLD_CTR_AND_INF)) offset = dissect_bssap_dlink_tunnel_payload_control_and_info(tvb, pinfo, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); break; @@ -1733,7 +1733,7 @@ static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if ( check_ie(tvb, tree, &offset, BSSAP_ULINK_TNL_PLD_CTR_AND_INF)) offset = dissect_bssap_ulink_tunnel_payload_control_and_info(tvb, pinfo, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); break; @@ -1757,31 +1757,31 @@ static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr /* Mobile station classmark Mobile station classmark 1 18.4.18 M TLV 3 */ if ( check_ie(tvb, tree, &offset, BSSAP_MOBILE_STN_CLS_MRK1)) offset = dissect_bssap_mobile_stn_cls_mrk1(tvb, bssap_tree, pinfo, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* Old location area identifier Location area identifier 18.4.14 O TLV 7 */ if ( check_optional_ie(tvb, offset, BSSAP_LOC_AREA_ID)) offset = dissect_bssap_loc_area_id(tvb, bssap_tree, pinfo, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* TMSI status TMSI status 18.4.24 O TLV 3 */ if ( check_optional_ie(tvb, offset, BSSAP_TMSI_STATUS)) offset = dissect_bssap_tmsi_status(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* New service area identification Service area identification 18.4.21b O TLV 9 */ if ( check_optional_ie(tvb, offset, BSSAP_SERVICE_AREA_ID)) offset = dissect_bssap_service_area_id(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* IMEISV IMEISV 18.4.9 O TLV 10 */ if ( check_optional_ie(tvb, offset, BSSAP_IMEISV)) offset = dissect_bssap_imesiv(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); break; @@ -1794,13 +1794,13 @@ static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if ( check_ie(tvb, tree, &offset, BSSAP_LOC_AREA_ID)) offset = dissect_bssap_loc_area_id(tvb, bssap_tree, pinfo, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* New TMSI, or IMSI Mobile identity 18.4.17 O TLV 6-10 */ if ( check_optional_ie(tvb, offset, BSSAP_MOBILE_ID)) offset = dissect_bssap_mobile_id(tvb, bssap_tree, pinfo, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); break; @@ -1811,7 +1811,7 @@ static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr /* Reject cause Reject cause 18.4.21 M TLV 3 */ if ( check_ie(tvb, tree, &offset, BSSAP_REJECT_CAUSE)) offset = dissect_bssap_reject_cause(tvb, bssap_tree, pinfo, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); break; @@ -1820,20 +1820,20 @@ static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if ( check_ie(tvb, tree, &offset, BSSAP_IMSI)) offset = dissect_bssap_imsi(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* Cell global identity Cell global identity 18.4.1 O TLV 10 */ if ( check_optional_ie(tvb, offset, BSSAP_CELL_GBL_ID)) offset = dissect_bssap_cell_global_id(tvb, bssap_tree, pinfo, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* Service area identification Service area identification 18.4.21b O TLV 9 */ if ( check_optional_ie(tvb, offset, BSSAP_SERVICE_AREA_ID)) offset = dissect_bssap_service_area_id(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); break; @@ -1842,7 +1842,7 @@ static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if ( check_ie(tvb, tree, &offset, BSSAP_IMSI)) offset = dissect_bssap_imsi(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); break; @@ -1851,7 +1851,7 @@ static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if ( check_ie(tvb, tree, &offset, BSSAP_IMSI)) offset = dissect_bssap_imsi(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); break; @@ -1864,7 +1864,7 @@ static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if ( check_ie(tvb, tree, &offset, BSSAP_GS_CAUSE)) offset = dissect_bssap_Gs_cause(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); break; @@ -1873,20 +1873,20 @@ static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if ( check_ie(tvb, tree, &offset, BSSAP_IMSI)) offset = dissect_bssap_imsi(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* Cell global identity Cell global identity 18.4.1 O TLV 10 */ if ( check_optional_ie(tvb, offset, BSSAP_CELL_GBL_ID)) offset = dissect_bssap_cell_global_id(tvb, bssap_tree, pinfo, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* Service area identification Service area identification 18.4.21b O TLV 9 */ if ( check_optional_ie(tvb, offset, BSSAP_SERVICE_AREA_ID)) offset = dissect_bssap_service_area_id(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); break; @@ -1903,20 +1903,20 @@ static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if ( check_ie(tvb, tree, &offset, BSSAP_IMSI_DET_FROM_GPRS_SERV_TYPE)) offset = dissect_bssap_imsi_det_from_gprs_serv_type(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* Cell global identity Cell global identity 18.4.1 O TLV 10 */ if ( check_optional_ie(tvb, offset, BSSAP_CELL_GBL_ID)) offset = dissect_bssap_cell_global_id(tvb, bssap_tree, pinfo, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* Service area identification Service area identification 18.4.21b O TLV 9 */ if ( check_optional_ie(tvb, offset, BSSAP_SERVICE_AREA_ID)) offset = dissect_bssap_service_area_id(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); break; @@ -1925,7 +1925,7 @@ static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if ( check_ie(tvb, tree, &offset, BSSAP_IMSI)) offset = dissect_bssap_imsi(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); break; @@ -1942,27 +1942,27 @@ static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if ( check_ie(tvb, tree, &offset, BSSAP_IMSI_DET_FROM_NON_GPRS_SERV_TYPE)) offset = dissect_bssap_imsi_det_from_non_gprs_serv_type(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* Cell global identity Cell global identity 18.4.1 O TLV 10 */ if ( check_optional_ie(tvb, offset, BSSAP_CELL_GBL_ID)) offset = dissect_bssap_cell_global_id(tvb, bssap_tree, pinfo, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* Location information age Location information age 18.4.14 O TLV 4 */ if ( check_optional_ie(tvb, offset, BSSAP_LOC_INF_AGE)) offset = dissect_bssap_location_information_age(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* Service area identification Service area identification 18.4.21b O TLV 9 */ if ( check_optional_ie(tvb, offset, BSSAP_SERVICE_AREA_ID)) offset = dissect_bssap_service_area_id(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); break; @@ -1971,7 +1971,7 @@ static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if ( check_ie(tvb, tree, &offset, BSSAP_IMSI)) offset = dissect_bssap_imsi(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); break; @@ -1980,14 +1980,14 @@ static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr /* SGSN number SGSN number 18.4.22 C TLV 5-11 */ if ( check_optional_ie(tvb, offset, BSSAP_SGSN_NUMBER)){ offset = dissect_bssap_sgsn_number(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); }else{ /* VLR number VLR number 18.4.26 C TLV 5-11 */ if ( check_optional_ie(tvb, offset, BSSAP_VLR_NUMBER)){ offset = dissect_bssap_vlr_number(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); } @@ -1999,14 +1999,14 @@ static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr /* SGSN number SGSN number 18.4.22 C TLV 5-11 */ if ( check_optional_ie(tvb, offset, BSSAP_SGSN_NUMBER)){ offset = dissect_bssap_sgsn_number(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); }else{ /* VLR number VLR number 18.4.26 C TLV 5-11 */ if ( check_optional_ie(tvb, offset, BSSAP_VLR_NUMBER)){ offset = dissect_bssap_vlr_number(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); } @@ -2022,7 +2022,7 @@ static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if ( check_ie(tvb, tree, &offset, BSSAP_INFO_REQ)) offset = dissect_bssap_info_req(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); @@ -2031,56 +2031,56 @@ static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr /* IMSI IMSI 18.4.10 M TLV 6-10 */ if ( check_ie(tvb, tree, &offset, BSSAP_IMSI)) offset = dissect_bssap_imsi(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* TMSI TMSI 18.4.23 O TLV 6 */ if ( check_optional_ie(tvb, offset, BSSAP_TMSI)) offset = dissect_bssap_tmsi(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* PTMSI PTMSI 18.4.20 O TLV 6 BSSAP_PTMSI*/ if ( check_optional_ie(tvb, offset, BSSAP_PTMSI)) offset = dissect_bssap_ptmsi(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* IMEI IMEI 18.4.8 O TLV 10 */ if ( check_optional_ie(tvb, offset, BSSAP_IMEI)) offset = dissect_bssap_imei(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* IMEISV IMEISV 18.4.9 O TLV 10 BSSAP_IMEISV*/ if ( check_optional_ie(tvb, offset, BSSAP_IMEISV)) offset = dissect_bssap_imesiv(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* Cell global identity Cell global identity 18.4.1 O TLV 10 */ if ( check_optional_ie(tvb, offset, BSSAP_CELL_GBL_ID)) offset = dissect_bssap_cell_global_id(tvb, bssap_tree, pinfo, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* Location information age Location information age 18.4.15 O TLV 4 */ if ( check_optional_ie(tvb, offset, BSSAP_LOC_INF_AGE)) offset = dissect_bssap_location_information_age(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* Mobile station state Mobile station state 18.4.19 O TLV 3 */ if ( check_optional_ie(tvb, offset, BSSAP_MOBILE_STN_STATE)) offset = dissect_bssap_mobile_station_state(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* Service area identification Service area identification 18.4.21b O TLV 9 */ if ( check_optional_ie(tvb, offset, BSSAP_SERVICE_AREA_ID)) offset = dissect_bssap_service_area_id(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); break; @@ -2089,12 +2089,12 @@ static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if ( check_ie(tvb, tree, &offset, BSSAP_IMSI)) offset = dissect_bssap_imsi(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; /* MM information MM information 18.4.16 O TLV 3-n */ if ( check_optional_ie(tvb, offset, BSSAP_MM_INFORMATION)) offset = dissect_bssap_MM_information(tvb, bssap_tree, pinfo, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); break; @@ -2110,7 +2110,7 @@ static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if ( check_ie(tvb, tree, &offset, BSSAP_ERRONEOUS_MSG)) offset = dissect_bssap_gprs_erroneous_msg(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); break; @@ -2123,7 +2123,7 @@ static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if ( check_ie(tvb, tree, &offset, BSSAP_GS_CAUSE)) offset = dissect_bssap_Gs_cause(tvb, bssap_tree, offset); - if (tvb_length_remaining(tvb,offset) == 0) + if (tvb_length_remaining(tvb,offset) <= 0) return; proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data"); break; |