More PVS-Studio issues flagged by Valerii Zapodovnikov.
/opt/SourceCode/wireshark/epan/dissectors/packet-frame.c 818 warn V547 Expression 'fi' is always true. /opt/SourceCode/wireshark/epan/dissectors/packet-gsm_sms.c 2692 warn V547 Expression 'length <= (offset - saved_offset)' is always false. /opt/SourceCode/wireshark/epan/dissectors/packet-isup.c 4688 warn V1037 Two or more case-branches perform the same actions. Check lines: 4688, 4697 /opt/SourceCode/wireshark/extcap/androiddump.c 1237 warn V560 A part of conditional expression is always true: data_str. /opt/SourceCode/wireshark/extcap/androiddump.c 1603 warn V547 Expression is always true. /opt/SourceCode/wireshark/ui/qt/models/packet_list_model.cpp 497 warn V560 A part of conditional expression is always true: ok_r1. For the voip_calls.c change, I preferred to initailize along with every other field, rather than set to actual value it gets set to later. For the isobus-vt change, I could not find a spec but followed the pattern from other error bit fields. Bug: 16335 Change-Id: Ie55082222b582f6fff4e8c7a992d863acee6cf15 Reviewed-on: https://code.wireshark.org/review/37160 Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com> Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
This commit is contained in:
parent
d795711a49
commit
569f3bd611
|
@ -815,7 +815,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
|
|||
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_WARNING,
|
||||
"Dissector %s incomplete in frame %u: undecoded byte number %u "
|
||||
"(0x%.4X+%u)",
|
||||
(fi ? fi->hfinfo->abbrev : "[unknown]"),
|
||||
fi->hfinfo->abbrev,
|
||||
pinfo->num, i, i - i % 16, i % 16);
|
||||
ensure_tree_item(tree, 1);
|
||||
proto_tree_add_expert_format(tree, pinfo, &ei_incomplete, tvb, i, 1, "Undecoded byte number: %u (0x%.4X+%u)", i, i - i % 16, i % 16);
|
||||
|
|
|
@ -2683,9 +2683,13 @@ dis_msg_status_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint
|
|||
{
|
||||
return;
|
||||
}
|
||||
pi = tvb_get_guint8(tvb, offset);
|
||||
|
||||
/* Read Parameter Indicator byte */
|
||||
pi = tvb_get_guint8(tvb, offset);
|
||||
dis_field_pi(tvb, tree, offset);
|
||||
offset++;
|
||||
|
||||
/* TODO: (9.2.3.27) If a Reserved bit is set to "1" then the receiving entity shall ignore the setting */
|
||||
|
||||
if (pi & 0x01)
|
||||
{
|
||||
|
@ -2696,10 +2700,9 @@ dis_msg_status_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint
|
|||
return;
|
||||
}
|
||||
|
||||
offset++;
|
||||
oct = tvb_get_guint8(tvb, offset);
|
||||
|
||||
dis_field_pid(tvb, tree, offset, oct);
|
||||
offset++;
|
||||
}
|
||||
|
||||
if (pi & 0x02)
|
||||
|
@ -2711,10 +2714,9 @@ dis_msg_status_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint
|
|||
return;
|
||||
}
|
||||
|
||||
offset++;
|
||||
oct = tvb_get_guint8(tvb, offset);
|
||||
|
||||
dis_field_dcs(tvb, tree, offset, oct, &seven_bit, &eight_bit, &ucs2, &compressed);
|
||||
offset++;
|
||||
}
|
||||
|
||||
if (pi & 0x04)
|
||||
|
@ -2726,7 +2728,6 @@ dis_msg_status_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint
|
|||
return;
|
||||
}
|
||||
|
||||
offset++;
|
||||
oct = tvb_get_guint8(tvb, offset);
|
||||
udl = oct;
|
||||
|
||||
|
@ -2735,8 +2736,6 @@ dis_msg_status_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint
|
|||
|
||||
if (udl > 0)
|
||||
{
|
||||
offset++;
|
||||
|
||||
dis_field_ud(tvb, pinfo, tree, offset, length - (offset - saved_offset), udhi, udl,
|
||||
seven_bit, eight_bit, ucs2, compressed, data);
|
||||
}
|
||||
|
|
|
@ -1956,7 +1956,8 @@ dissect_vt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, enum vt_directio
|
|||
proto_item_append_text(ti, ": ");
|
||||
if (error_codes & 0x01)
|
||||
proto_item_append_text(ti, "Audio device is busy, subsequent commands use the new setting ");
|
||||
if (error_codes & 0x01)
|
||||
/* TODO: Haven't confirmed this bit against spec, but was previously wrongly also 0x01 */
|
||||
if (error_codes & 0x02)
|
||||
proto_item_append_text(ti, "Command is not supported ");
|
||||
if (error_codes & 0x10)
|
||||
proto_item_append_text(ti, "Any other error ");
|
||||
|
|
|
@ -1234,7 +1234,7 @@ static int register_interfaces(extcap_parameters * extcap_conf, const char *adb_
|
|||
response[data_length] = '\0';
|
||||
data_str = strtok(response, "\n");
|
||||
while (data_str != NULL) {
|
||||
if (data_str && sscanf(data_str, "%*s %15s", pid) == 1 && strlen(pid) > 10 && strcmp(pid + 9, "22A8") == 0) {
|
||||
if (sscanf(data_str, "%*s %15s", pid) == 1 && strlen(pid) > 10 && strcmp(pid + 9, "22A8") == 0) {
|
||||
g_debug("Btsnoop Net Port for %s is %s", serial_number, pid + 9);
|
||||
break;
|
||||
}
|
||||
|
@ -1562,7 +1562,7 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
|
|||
|
||||
frame_length = raw_length * 3 + (raw_length / 20) * 4 + ((raw_length % 20) ? 2 : -2) + 29;
|
||||
|
||||
if (used_buffer_length + length < frame_length) {
|
||||
if ((used_buffer_length + length) < frame_length) {
|
||||
used_buffer_length += length;
|
||||
break;
|
||||
}
|
||||
|
@ -1600,12 +1600,8 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
|
|||
ts,
|
||||
ms * 1000);
|
||||
|
||||
if (used_buffer_length + length >= frame_length) {
|
||||
memmove(data, data + frame_length, (size_t)(used_buffer_length + length - frame_length));
|
||||
used_buffer_length = (gssize)(used_buffer_length + length - frame_length);
|
||||
length = 0;
|
||||
continue;
|
||||
}
|
||||
memmove(data, data + frame_length, (size_t)(used_buffer_length + length - frame_length));
|
||||
used_buffer_length = (gssize)(used_buffer_length + length - frame_length);
|
||||
length = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -494,7 +494,7 @@ bool PacketListModel::recordLessThan(PacketListRecord *r1, PacketListRecord *r2)
|
|||
// either r1 is invalid (and sort it before others) or both
|
||||
// r1 and r2 are valid (sort normally)
|
||||
cmp_val = -1;
|
||||
} else if (!ok_r2 || (ok_r1 && num_r1 > num_r2)) {
|
||||
} else if (!ok_r2 || (num_r1 > num_r2)) {
|
||||
cmp_val = 1;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -1442,9 +1442,7 @@ isup_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt,
|
|||
tapinfo->completed_calls++;
|
||||
}
|
||||
/* Overwrite any comment set above */
|
||||
if (comment) {
|
||||
g_free(comment);
|
||||
}
|
||||
g_free(comment);
|
||||
comment = g_strdup_printf("Cause %i - %s",
|
||||
pi->cause_value,
|
||||
val_to_str_ext_const(pi->cause_value, &q931_cause_code_vals_ext, "(Unknown)"));
|
||||
|
@ -3655,7 +3653,7 @@ unistim_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *e
|
|||
} else if(pi->stream_connect == 1 && callsinfo == NULL) {
|
||||
|
||||
/* Research indicates some nortel products initiate stream first
|
||||
* without keypresses. therefore creating this solely on a keypress is
|
||||
* without keypresses, therefore creating this solely on a keypress is
|
||||
* ineffective.
|
||||
* Sometimes calls start immediately with open stream.
|
||||
*/
|
||||
|
@ -3679,7 +3677,7 @@ unistim_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *e
|
|||
/* Clear tap struct */
|
||||
tmp_unistim_info->rudp_type = 0;
|
||||
tmp_unistim_info->payload_type = 0;
|
||||
tmp_unistim_info->sequence = pi->sequence;
|
||||
tmp_unistim_info->sequence = 0;
|
||||
tmp_unistim_info->termid = 0;
|
||||
tmp_unistim_info->key_val = -1;
|
||||
tmp_unistim_info->key_state = -1;
|
||||
|
|
Loading…
Reference in New Issue