diff options
author | Michal Labedzki <michal.labedzki@tieto.com> | 2014-07-23 12:26:05 +0200 |
---|---|---|
committer | Michal Labedzki <michal.labedzki@tieto.com> | 2014-09-22 10:52:03 +0000 |
commit | 56a09d24dcdcaddae1cb67a18bbc2fd588c427ed (patch) | |
tree | a9961e4700a00680f7247d714709e6164f9e5d9d /epan/dissectors | |
parent | c1d6a4123a2e100a77ae8ec2b3d01544f168febc (diff) |
Try to fix some buildbot warnings
Most interesting are:
warning: cannot optimize loop, the loop counter may overflow [-Wunsafe-loop-optimizations]
warning: ISO C forbids zero-size array [-Wpedantic]
warning: ISO C90 doesn't support unnamed structs/unions [-Wpedantic]
warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual
warning: initializer element is not computable at load time [enabled by default]
Change-Id: I5573c6bdca856a304877d9bef643f8c0fa93cdaf
Reviewed-on: https://code.wireshark.org/review/3174
Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-btavdtp.c | 1 | ||||
-rw-r--r-- | epan/dissectors/packet-btbnep.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-bthci_cmd.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-btsdp.c | 121 | ||||
-rw-r--r-- | epan/dissectors/packet-logcat-text.c | 18 | ||||
-rw-r--r-- | epan/dissectors/packet-usb-audio.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-usb-com.c | 1 | ||||
-rw-r--r-- | epan/dissectors/packet-usb.c | 4 |
8 files changed, 66 insertions, 91 deletions
diff --git a/epan/dissectors/packet-btavdtp.c b/epan/dissectors/packet-btavdtp.c index 34ed726b6f..fa06c34c29 100644 --- a/epan/dissectors/packet-btavdtp.c +++ b/epan/dissectors/packet-btavdtp.c @@ -1276,7 +1276,6 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown direction %d ", direction); goto LABEL_data; - break; } l2cap_data = (btl2cap_data_t *) data; diff --git a/epan/dissectors/packet-btbnep.c b/epan/dissectors/packet-btbnep.c index 20a3d27343..6c430b73b1 100644 --- a/epan/dissectors/packet-btbnep.c +++ b/epan/dissectors/packet-btbnep.c @@ -154,7 +154,7 @@ dissect_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) guint16 uuid_dst; guint16 uuid_src; guint16 response_message; - guint list_length; + guint16 list_length; guint i_item; proto_tree_add_item(tree, hf_btbnep_control_type, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -203,7 +203,7 @@ dissect_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) list_length = tvb_get_ntohs(tvb, offset); offset += 2; - for (i_item = 0; i_item < list_length; i_item += 4) { + for (i_item = 0; i_item + 4 > i_item && i_item < list_length; i_item += 4) { proto_tree_add_item(tree, hf_btbnep_network_type_start, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; @@ -223,7 +223,7 @@ dissect_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) list_length = tvb_get_ntohs(tvb, offset); offset += 2; - for (i_item = 0; i_item < list_length; i_item += 12) { + for (i_item = 0; i_item + 12 > i_item && i_item < list_length; i_item += 12) { proto_tree_add_item(tree, hf_btbnep_multicast_address_start, tvb, offset, 6, ENC_NA); offset += 6; diff --git a/epan/dissectors/packet-bthci_cmd.c b/epan/dissectors/packet-bthci_cmd.c index 86d5da6d18..5aef3b8a31 100644 --- a/epan/dissectors/packet-bthci_cmd.c +++ b/epan/dissectors/packet-bthci_cmd.c @@ -4988,7 +4988,7 @@ dissect_eir_ad_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint8 length; guint8 type; guint8 data_size; - gint end_offset; + gint64 end_offset; guint i_uuid; data_size = tvb_length(tvb); diff --git a/epan/dissectors/packet-btsdp.c b/epan/dissectors/packet-btsdp.c index 6bf6c841e0..420e3d5fc8 100644 --- a/epan/dissectors/packet-btsdp.c +++ b/epan/dissectors/packet-btsdp.c @@ -1237,6 +1237,7 @@ reassemble_continuation_state(tvbuff_t *tvb, packet_info *pinfo, tid_request_t *tid_request; continuation_state_data_t *continuation_state_data; wmem_tree_key_t key[12]; + wmem_tree_t *subtree; guint32 k_interface_id; guint32 k_adapter_id; guint32 k_chandle; @@ -1244,13 +1245,13 @@ reassemble_continuation_state(tvbuff_t *tvb, packet_info *pinfo, guint32 k_tid; guint32 k_pdu_type; guint32 k_frame_number; - guint8 *k_continuation_state; + guint32 *k_continuation_state_array; + guint8 *continuation_state; guint32 interface_id; guint32 adapter_id; guint32 chandle; guint32 psm; guint32 frame_number; - guint32 *continuation_state_array; if (new_tvb) *new_tvb = NULL; @@ -1330,14 +1331,10 @@ reassemble_continuation_state(tvbuff_t *tvb, packet_info *pinfo, if (tid_request->continuation_state_length > 0) { /* fetch tid_request->continuation_state */ - k_continuation_state = (guint8 *) wmem_alloc0(wmem_packet_scope(), 20); - k_continuation_state[0] = tid_request->continuation_state_length; - memcpy(&k_continuation_state[1], tid_request->continuation_state, tid_request->continuation_state_length); - continuation_state_array = (guint32 *) k_continuation_state; - - k_continuation_state = (guint8 *) wmem_alloc0(wmem_packet_scope(), 20); - k_continuation_state[0] = tid_request->continuation_state_length; - memcpy(&k_continuation_state[1], tid_request->continuation_state, tid_request->continuation_state_length); + k_continuation_state_array = (guint32 *) wmem_alloc0(wmem_packet_scope(), 20); + continuation_state = (guint8 *) k_continuation_state_array; + continuation_state[0] = tid_request->continuation_state_length; + memcpy(&continuation_state[1], tid_request->continuation_state, tid_request->continuation_state_length); k_interface_id = interface_id; k_adapter_id = adapter_id; @@ -1357,15 +1354,15 @@ reassemble_continuation_state(tvbuff_t *tvb, packet_info *pinfo, key[4].length = 1; key[4].key = &k_pdu_type; key[5].length = 1; - key[5].key = (guint32 *) &k_continuation_state[0]; + key[5].key = &k_continuation_state_array[0]; key[6].length = 1; - key[6].key = (guint32 *) &k_continuation_state[4]; + key[6].key = &k_continuation_state_array[1]; key[7].length = 1; - key[7].key = (guint32 *) &k_continuation_state[8]; + key[7].key = &k_continuation_state_array[2]; key[8].length = 1; - key[8].key = (guint32 *) &k_continuation_state[12]; + key[8].key = &k_continuation_state_array[3]; key[9].length = 1; - key[9].key = (guint32 *) &k_continuation_state[16]; + key[9].key = &k_continuation_state_array[4]; key[10].length = 1; key[10].key = &k_frame_number; key[11].length = 0; @@ -1377,11 +1374,11 @@ reassemble_continuation_state(tvbuff_t *tvb, packet_info *pinfo, continuation_state_data->chandle == chandle && continuation_state_data->psm == psm && continuation_state_data->pdu_type == tid_request->pdu_type && - continuation_state_data->continuation_state[0] == continuation_state_array[0] && - continuation_state_data->continuation_state[1] == continuation_state_array[1] && - continuation_state_data->continuation_state[2] == continuation_state_array[2] && - continuation_state_data->continuation_state[3] == continuation_state_array[3] && - continuation_state_data->continuation_state[4] == continuation_state_array[4]) { + continuation_state_data->continuation_state[0] == k_continuation_state_array[0] && + continuation_state_data->continuation_state[1] == k_continuation_state_array[1] && + continuation_state_data->continuation_state[2] == k_continuation_state_array[2] && + continuation_state_data->continuation_state[3] == k_continuation_state_array[3] && + continuation_state_data->continuation_state[4] == k_continuation_state_array[4]) { tid_request->data = (guint8 *) wmem_alloc(wmem_file_scope(), continuation_state_data->data_length + attribute_list_byte_count); tid_request->data_length = continuation_state_data->data_length + attribute_list_byte_count; memcpy(tid_request->data, continuation_state_data->data, continuation_state_data->data_length); @@ -1443,16 +1440,16 @@ reassemble_continuation_state(tvbuff_t *tvb, packet_info *pinfo, } } } else { - guint8 *continuation_state; + guint8 *continuation_state_buffer; guint8 continuation_state_length; guint8 *packet_scope_string; continuation_state_length = tvb_get_guint8(tvb, offset); offset++; - continuation_state = (guint8 *) wmem_alloc(wmem_file_scope(), continuation_state_length); + continuation_state_buffer = (guint8 *) wmem_alloc(wmem_file_scope(), continuation_state_length); packet_scope_string = tvb_bytes_to_ep_str(tvb, offset, continuation_state_length); - memcpy(continuation_state, packet_scope_string, continuation_state_length); + memcpy(continuation_state_buffer, packet_scope_string, continuation_state_length); if (!pinfo->fd->flags.visited) { if (is_request) { @@ -1479,7 +1476,7 @@ reassemble_continuation_state(tvbuff_t *tvb, packet_info *pinfo, tid_request->pdu_type = pdu_type; - tid_request->continuation_state = continuation_state; + tid_request->continuation_state = continuation_state_buffer; tid_request->continuation_state_length = continuation_state_length; wmem_tree_insert32_array(tid_requests, key, tid_request); @@ -1494,22 +1491,16 @@ reassemble_continuation_state(tvbuff_t *tvb, packet_info *pinfo, if (tid_request->continuation_state_length > 0) { /* fetch tid_request->continuation_state */ - - k_continuation_state = (guint8 *) wmem_alloc0(wmem_packet_scope(), 20); - k_continuation_state[0] = tid_request->continuation_state_length; - memcpy(&k_continuation_state[1], tid_request->continuation_state, tid_request->continuation_state_length); - continuation_state_array = (guint32 *) k_continuation_state; - - k_continuation_state = (guint8 *) wmem_alloc0(wmem_packet_scope(), 20); - k_continuation_state[0] = tid_request->continuation_state_length; - memcpy(&k_continuation_state[1], tid_request->continuation_state, tid_request->continuation_state_length); + k_continuation_state_array = (guint32 *) wmem_alloc0(wmem_packet_scope(), 20); + continuation_state = (guint8 *) k_continuation_state_array; + continuation_state[0] = tid_request->continuation_state_length; + memcpy(&continuation_state[1], tid_request->continuation_state, tid_request->continuation_state_length); k_interface_id = interface_id; k_adapter_id = adapter_id; k_chandle = chandle; k_psm = psm; k_pdu_type = tid_request->pdu_type; - k_frame_number = frame_number; key[0].length = 1; key[0].key = &k_interface_id; @@ -1522,31 +1513,21 @@ reassemble_continuation_state(tvbuff_t *tvb, packet_info *pinfo, key[4].length = 1; key[4].key = &k_pdu_type; key[5].length = 1; - key[5].key = (guint32 *) &k_continuation_state[0]; + key[5].key = &k_continuation_state_array[0]; key[6].length = 1; - key[6].key = (guint32 *) &k_continuation_state[4]; + key[6].key = &k_continuation_state_array[1]; key[7].length = 1; - key[7].key = (guint32 *) &k_continuation_state[8]; + key[7].key = &k_continuation_state_array[2]; key[8].length = 1; - key[8].key = (guint32 *) &k_continuation_state[12]; + key[8].key = &k_continuation_state_array[3]; key[9].length = 1; - key[9].key = (guint32 *) &k_continuation_state[16]; - key[10].length = 1; - key[10].key = &k_frame_number; - key[11].length = 0; - key[11].key = NULL; + key[9].key = &k_continuation_state_array[4]; + key[10].length = 0; + key[10].key = NULL; - continuation_state_data = (continuation_state_data_t *) wmem_tree_lookup32_array_le(continuation_states, key); - if (continuation_state_data && continuation_state_data->interface_id == interface_id && - continuation_state_data->adapter_id == adapter_id && - continuation_state_data->chandle == chandle && - continuation_state_data->psm == psm && - continuation_state_data->pdu_type == tid_request->pdu_type && - continuation_state_data->continuation_state[0] == continuation_state_array[0] && - continuation_state_data->continuation_state[1] == continuation_state_array[1] && - continuation_state_data->continuation_state[2] == continuation_state_array[2] && - continuation_state_data->continuation_state[3] == continuation_state_array[3] && - continuation_state_data->continuation_state[4] == continuation_state_array[4]) { + subtree = (wmem_tree_t *) wmem_tree_lookup32_array(continuation_states, key); + continuation_state_data = (subtree) ? (continuation_state_data_t *) wmem_tree_lookup32_le(subtree, frame_number) : NULL; + if (continuation_state_data) { tid_request->data = (guint8 *) wmem_alloc(wmem_file_scope(), continuation_state_data->data_length + attribute_list_byte_count); tid_request->data_length = continuation_state_data->data_length + attribute_list_byte_count; memcpy(tid_request->data, continuation_state_data->data, continuation_state_data->data_length); @@ -1563,14 +1544,10 @@ reassemble_continuation_state(tvbuff_t *tvb, packet_info *pinfo, if (record_handle) *record_handle = tid_request->record_handle; /* save tid_request in continuation_state data */ - k_continuation_state = (guint8 *) wmem_alloc0(wmem_packet_scope(), 20); - k_continuation_state[0] = continuation_state_length; - memcpy(&k_continuation_state[1], continuation_state, continuation_state_length); - continuation_state_array = (guint32 *) k_continuation_state; - - k_continuation_state = (guint8 *) wmem_alloc0(wmem_packet_scope(), 20); - k_continuation_state[0] = continuation_state_length; - memcpy(&k_continuation_state[1], continuation_state, continuation_state_length); + k_continuation_state_array = (guint32 *) wmem_alloc0(wmem_packet_scope(), 20); + continuation_state = (guint8 *) k_continuation_state_array; + continuation_state[0] = continuation_state_length; + memcpy(&continuation_state[1], continuation_state_buffer, continuation_state_length); k_interface_id = interface_id; k_adapter_id = adapter_id; @@ -1590,15 +1567,15 @@ reassemble_continuation_state(tvbuff_t *tvb, packet_info *pinfo, key[4].length = 1; key[4].key = &k_pdu_type; key[5].length = 1; - key[5].key = (guint32 *) &k_continuation_state[0]; + key[5].key = &k_continuation_state_array[0]; key[6].length = 1; - key[6].key = (guint32 *) &k_continuation_state[4]; + key[6].key = &k_continuation_state_array[1]; key[7].length = 1; - key[7].key = (guint32 *) &k_continuation_state[8]; + key[7].key = &k_continuation_state_array[2]; key[8].length = 1; - key[8].key = (guint32 *) &k_continuation_state[12]; + key[8].key = &k_continuation_state_array[3]; key[9].length = 1; - key[9].key = (guint32 *) &k_continuation_state[16]; + key[9].key = &k_continuation_state_array[4]; key[10].length = 1; key[10].key = &k_frame_number; key[11].length = 0; @@ -1610,11 +1587,11 @@ reassemble_continuation_state(tvbuff_t *tvb, packet_info *pinfo, continuation_state_data->chandle = chandle; continuation_state_data->psm = psm; continuation_state_data->pdu_type = pdu_type; - continuation_state_data->continuation_state[0] = continuation_state_array[0]; - continuation_state_data->continuation_state[1] = continuation_state_array[1]; - continuation_state_data->continuation_state[2] = continuation_state_array[2]; - continuation_state_data->continuation_state[3] = continuation_state_array[3]; - continuation_state_data->continuation_state[4] = continuation_state_array[4]; + continuation_state_data->continuation_state[0] = k_continuation_state_array[0]; + continuation_state_data->continuation_state[1] = k_continuation_state_array[1]; + continuation_state_data->continuation_state[2] = k_continuation_state_array[2]; + continuation_state_data->continuation_state[3] = k_continuation_state_array[3]; + continuation_state_data->continuation_state[4] = k_continuation_state_array[4]; continuation_state_data->data = tid_request->data; continuation_state_data->data_length = tid_request->data_length; diff --git a/epan/dissectors/packet-logcat-text.c b/epan/dissectors/packet-logcat-text.c index 5699e4d75b..1f043c2376 100644 --- a/epan/dissectors/packet-logcat-text.c +++ b/epan/dissectors/packet-logcat-text.c @@ -79,7 +79,7 @@ typedef int (*tGETTER) (const gchar *frame, const gchar *token, tvbuff_t *tvb, proto_tree *maintree, gint start_offset, packet_info *pinfo); typedef struct { - GRegex *regex; + GRegex **regex; const tGETTER *getters; guint no_of_getters; } dissect_info_t; @@ -206,7 +206,7 @@ static int dissect_logcat_text(tvbuff_t *tvb, proto_tree *tree, packet_info *pin if (!g_regex_match(special_regex, frame, G_REGEX_MATCH_NOTEMPTY, NULL)) { - tokens = g_regex_split(dinfo->regex, frame, G_REGEX_MATCH_NOTEMPTY); + tokens = g_regex_split(*dinfo->regex, frame, G_REGEX_MATCH_NOTEMPTY); if (NULL == tokens) return 0; if (g_strv_length(tokens) != dinfo->no_of_getters + 2) { proto_tree_add_expert(maintree, pinfo, &ei_malformed_token, tvb, offset, -1); @@ -229,7 +229,7 @@ static int dissect_logcat_text(tvbuff_t *tvb, proto_tree *tree, packet_info *pin static int dissect_logcat_text_brief(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { static const tGETTER getters[] = { get_priority, get_tag, get_pid, get_log }; - dissect_info_t dinfo = { brief_regex, getters, array_length(getters) }; + dissect_info_t dinfo = { &brief_regex, getters, array_length(getters) }; return dissect_logcat_text(tvb, tree, pinfo, &dinfo); } @@ -237,7 +237,7 @@ static int dissect_logcat_text_brief(tvbuff_t *tvb, packet_info *pinfo, proto_tr static int dissect_logcat_text_tag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { static const tGETTER getters[] = { get_priority, get_tag, get_log }; - dissect_info_t dinfo = { tag_regex, getters, array_length(getters) }; + dissect_info_t dinfo = { &tag_regex, getters, array_length(getters) }; return dissect_logcat_text(tvb, tree, pinfo, &dinfo); } @@ -245,7 +245,7 @@ static int dissect_logcat_text_tag(tvbuff_t *tvb, packet_info *pinfo, proto_tree static int dissect_logcat_text_process(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { static const tGETTER getters[] = { get_priority, get_pid, get_log }; - dissect_info_t dinfo = { process_regex, getters, array_length(getters) }; + dissect_info_t dinfo = { &process_regex, getters, array_length(getters) }; SET_ADDRESS(&pinfo->dst, AT_STRINGZ, 0, ""); SET_ADDRESS(&pinfo->src, AT_STRINGZ, 0, ""); @@ -256,7 +256,7 @@ static int dissect_logcat_text_process(tvbuff_t *tvb, packet_info *pinfo, proto_ static int dissect_logcat_text_time(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { static const tGETTER getters[] = { get_time, get_priority, get_tag, get_pid, get_log }; - dissect_info_t dinfo = { time_regex, getters, array_length(getters) }; + dissect_info_t dinfo = { &time_regex, getters, array_length(getters) }; return dissect_logcat_text(tvb, tree, pinfo, &dinfo); } @@ -264,7 +264,7 @@ static int dissect_logcat_text_time(tvbuff_t *tvb, packet_info *pinfo, proto_tre static int dissect_logcat_text_thread(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { static const tGETTER getters[] = { get_priority, get_pid, get_tid, get_log }; - dissect_info_t dinfo = { thread_regex, getters, array_length(getters) }; + dissect_info_t dinfo = { &thread_regex, getters, array_length(getters) }; SET_ADDRESS(&pinfo->dst, AT_STRINGZ, 0, ""); SET_ADDRESS(&pinfo->src, AT_STRINGZ, 0, ""); @@ -275,7 +275,7 @@ static int dissect_logcat_text_thread(tvbuff_t *tvb, packet_info *pinfo, proto_t static int dissect_logcat_text_threadtime(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { static const tGETTER getters[] = { get_time, get_pid, get_tid, get_priority, get_tag, get_log }; - dissect_info_t dinfo = { threadtime_regex, getters, array_length(getters) }; + dissect_info_t dinfo = { &threadtime_regex, getters, array_length(getters) }; return dissect_logcat_text(tvb, tree, pinfo, &dinfo); } @@ -283,7 +283,7 @@ static int dissect_logcat_text_threadtime(tvbuff_t *tvb, packet_info *pinfo, pro static int dissect_logcat_text_long(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { static const tGETTER getters[] = { get_time, get_pid, get_tid, get_priority, get_tag, get_log }; - dissect_info_t dinfo = { long_regex, getters, array_length(getters) }; + dissect_info_t dinfo = { &long_regex, getters, array_length(getters) }; return dissect_logcat_text(tvb, tree, pinfo, &dinfo); } diff --git a/epan/dissectors/packet-usb-audio.c b/epan/dissectors/packet-usb-audio.c index 9bee878197..0b654b36d6 100644 --- a/epan/dissectors/packet-usb-audio.c +++ b/epan/dissectors/packet-usb-audio.c @@ -490,7 +490,7 @@ dissect_usb_audio_bulk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tre { usb_conv_info_t *usb_conv_info; proto_tree *tree = NULL; - guint offset; + gint offset; guint length = tvb_length(tvb); @@ -515,7 +515,7 @@ dissect_usb_audio_bulk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tre offset = 0; col_set_str(pinfo->cinfo, COL_INFO, "USB-MIDI Event Packets"); - while (offset < length) + while (offset > 0 && (guint) offset < length) { dissect_usb_midi_event(tvb, pinfo, tree, parent_tree, offset); offset += 4; diff --git a/epan/dissectors/packet-usb-com.c b/epan/dissectors/packet-usb-com.c index 21b3d535b7..dca25c5605 100644 --- a/epan/dissectors/packet-usb-com.c +++ b/epan/dissectors/packet-usb-com.c @@ -556,7 +556,6 @@ dissect_usb_com_bulk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * case 0x01: /* Network Transfer Block */ case 0x02: /* Network Transfer Block (IP + DSS) */ return call_dissector_only(mbim_bulk_handle, tvb, pinfo, tree, NULL); - break; default: break; } diff --git a/epan/dissectors/packet-usb.c b/epan/dissectors/packet-usb.c index 4bdcfb58ce..98940522c5 100644 --- a/epan/dissectors/packet-usb.c +++ b/epan/dissectors/packet-usb.c @@ -1104,7 +1104,7 @@ get_usb_conv_info(conversation_t *conversation) /* usb_conv_info_t contains some components that are valid only for one specific packet clear_usb_conv_tmp_data() clears these components, it should be called before we dissect a new packet */ -void clear_usb_conv_tmp_data(usb_conv_info_t *usb_conv_info) +static void clear_usb_conv_tmp_data(usb_conv_info_t *usb_conv_info) { /* caller must have checked that usb_conv_info!= NULL */ @@ -1597,7 +1597,7 @@ dissect_usb_string_descriptor(packet_info *pinfo _U_, proto_tree *parent_tree, if (!usb_trans_info->u.get_descriptor.index) { /* list of languanges */ - while(len>(offset-old_offset)) { + while (offset >= old_offset && len > (offset - old_offset)) { /* wLANGID */ proto_tree_add_item(tree, hf_usb_wLANGID, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset+=2; |