Bluetooth: OBEX: Fix crash when there is no Type/Name header in request

Not all requests have them, so check for them to avoid crash.

Change-Id: I265fb8ad9f63132bee6eeb1aa521cae8b8df82b9
Reviewed-on: https://code.wireshark.org/review/8521
Reviewed-by: Michal Orynicz <michal.orynicz@tieto.com>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Michal Labedzki 2015-05-18 12:15:43 +02:00 committed by Michael Mann
parent 9b99bdb09f
commit 930f5b5402
1 changed files with 3 additions and 1 deletions

View File

@ -1995,6 +1995,7 @@ dissect_headers(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo,
}
if (value_length > 0 && obex_last_opcode_data &&
(obex_last_opcode_data->code == BTOBEX_CODE_VALS_GET || obex_last_opcode_data->code == BTOBEX_CODE_VALS_PUT) &&
obex_last_opcode_data->data.get_put.type &&
dissector_try_string(media_type_dissector_table, obex_last_opcode_data->data.get_put.type, next_tvb, pinfo, tree, data) > 0) {
offset += value_length;
} else {
@ -2544,7 +2545,7 @@ dissect_btobex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
key[5].length = 0;
key[5].key = NULL;
obex_last_opcode_data = wmem_new(wmem_file_scope(), obex_last_opcode_data_t);
obex_last_opcode_data = wmem_new0(wmem_file_scope(), obex_last_opcode_data_t);
obex_last_opcode_data->interface_id = interface_id;
obex_last_opcode_data->adapter_id = adapter_id;
obex_last_opcode_data->chandle = chandle;
@ -2690,6 +2691,7 @@ dissect_btobex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
dissect_headers(main_tree, next_tvb, offset, pinfo, profile, is_obex_over_l2cap, obex_last_opcode_data, data);
if (!pinfo->fd->flags.visited &&
obex_last_opcode_data &&
obex_last_opcode_data->data.set_data.name &&
obex_last_opcode_data->code == BTOBEX_CODE_VALS_SET_PATH &&
code == BTOBEX_CODE_VALS_SUCCESS) {
save_path(pinfo, path, obex_last_opcode_data->data.set_data.name, obex_last_opcode_data->data.set_data.go_up, is_obex_over_l2cap, data);