From 569f3bd6111cfebe2fcd62484d854a053b5c9636 Mon Sep 17 00:00:00 2001 From: Martin Mathieson Date: Thu, 7 May 2020 18:25:35 +0100 Subject: 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 Reviewed-by: Martin Mathieson --- extcap/androiddump.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'extcap') diff --git a/extcap/androiddump.c b/extcap/androiddump.c index d3535d72f0..91c9f8093c 100644 --- a/extcap/androiddump.c +++ b/extcap/androiddump.c @@ -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; } } -- cgit v1.2.3