Some more issues identified by PVS-Studio.

/opt/SourceCode/wireshark/epan/dissectors/packet-osc.c	367	err	V562 It's odd to compare 0 or 1 with a value of 0.
/opt/SourceCode/wireshark/epan/dissectors/packet-rpc.c	960	note	V576 Incorrect format. Consider checking the eighth actual argument of the 'proto_tree_add_subtree_format' function. The SIGNED integer type argument is expected.
/opt/SourceCode/wireshark/epan/dissectors/packet-rpc.c	980	note	V576 Incorrect format. Consider checking the third actual argument of the 'proto_item_append_text' function. The SIGNED integer type argument is expected.
/opt/SourceCode/wireshark/epan/dissectors/packet-rpc.c	2473	note	V576 Incorrect format. Consider checking the fourth actual argument of the 'col_prepend_fstr' function. The SIGNED integer type argument is expected.
/opt/SourceCode/wireshark/epan/dissectors/packet-rpc.c	2482	note	V576 Incorrect format. Consider checking the fourth actual argument of the 'col_append_fstr' function. The SIGNED integer type argument is expected.
/opt/SourceCode/wireshark/epan/dissectors/packet-rpc.c	2633	note	V576 Incorrect format. Consider checking the fourth actual argument of the 'col_append_fstr' function. The SIGNED integer type argument is expected.
/opt/SourceCode/wireshark/epan/dissectors/packet-rpc.c	2650	note	V576 Incorrect format. Consider checking the fourth actual argument of the 'col_prepend_fstr' function. The SIGNED integer type argument is expected.
/opt/SourceCode/wireshark/epan/dissectors/packet-stun.c	565	warn	V1051 Consider checking for misprints. It's possible that the 'reported_length' should be checked here.
/opt/SourceCode/wireshark/epan/dissectors/packet-umts_fp.c	4126	warn	V1051 Consider checking for misprints. It's possible that the 'reported_length' should be checked here.
/opt/SourceCode/wireshark/epan/dissectors/packet-umts_fp.c	4942	warn	V1051 Consider checking for misprints. It's possible that the 'reported_length' should be checked here.
/opt/SourceCode/wireshark/ui/voip_calls.c	1444	err	V773 The 'comment' pointer was assigned values twice without releasing the memory. A memory leak is possible.
/opt/SourceCode/wireshark/wsutil/filesystem.c	1531	err	V773 The function was exited without releasing the 'files' pointer. A memory leak is possible.
/opt/SourceCode/wireshark/wsutil/filesystem.c	1717	err	V773 The function was exited without releasing the 'files' pointer. A memory leak is possible.

Bug: 16335
Change-Id: I8df3ba6d070823dcb43c4152d9156358f701e8dc
Reviewed-on: https://code.wireshark.org/review/37069
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
This commit is contained in:
Martin Mathieson 2020-05-03 13:15:52 +01:00 committed by Guy Harris
parent 60622e63fd
commit 6ba8bd037f
6 changed files with 22 additions and 18 deletions

View File

@ -364,7 +364,7 @@ is_valid_path(const char *path)
if(path[0] != '/')
return FALSE;
for(ptr=path+1; *ptr!='\0'; ptr++)
if( (g_ascii_isprint(*ptr) == 0) || (strchr(invalid_path_chars, *ptr) != NULL) )
if(!g_ascii_isprint(*ptr) || (strchr(invalid_path_chars, *ptr) != NULL) )
return FALSE;
return TRUE;
}

View File

@ -958,7 +958,7 @@ dissect_rpc_authunix_groups(tvbuff_t* tvb, proto_tree* tree, int offset)
gids_count = tvb_get_ntohl(tvb,offset);
gtree = proto_tree_add_subtree_format(tree, tvb, offset,
4+gids_count*4, ett_rpc_gids, &gitem, "Auxiliary GIDs (%d)", gids_count);
4+gids_count*4, ett_rpc_gids, &gitem, "Auxiliary GIDs (%u)", gids_count);
offset += 4;
/* first, open with [ */
@ -977,7 +977,7 @@ dissect_rpc_authunix_groups(tvbuff_t* tvb, proto_tree* tree, int offset)
if (gids_i > 0)
proto_item_append_text(gitem, ", ");
proto_item_append_text(gitem, "%d", gids_entry);
proto_item_append_text(gitem, "%u", gids_entry);
} else if (tree && gids_i == 16) {
proto_item_append_text(gitem, "...");
}
@ -2471,7 +2471,7 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* No, so it's a duplicate request.
Mark it as such. */
col_prepend_fstr(pinfo->cinfo, COL_INFO,
"[RPC retransmission of #%d]",
"[RPC retransmission of #%u]",
rpc_call->req_num);
proto_tree_add_item(rpc_tree, hf_rpc_dup, tvb,
0, 0, ENC_NA);
@ -2479,7 +2479,7 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
tvb, 0,0, rpc_call->req_num);
}
if(rpc_call->rep_num){
col_append_fstr(pinfo->cinfo, COL_INFO," (Reply In %d)", rpc_call->rep_num);
col_append_fstr(pinfo->cinfo, COL_INFO," (Reply In %u)", rpc_call->rep_num);
}
} else {
/* Prepare the value data.
@ -2630,7 +2630,7 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
&ns);
proto_item_set_generated(tmp_item);
col_append_fstr(pinfo->cinfo, COL_INFO," (Call In %d)", rpc_call->req_num);
col_append_fstr(pinfo->cinfo, COL_INFO," (Call In %u)", rpc_call->req_num);
}
@ -2648,7 +2648,7 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* No, so it's a duplicate reply.
Mark it as such. */
col_prepend_fstr(pinfo->cinfo, COL_INFO,
"[RPC duplicate of #%d]", rpc_call->rep_num);
"[RPC duplicate of #%u]", rpc_call->rep_num);
tmp_item=proto_tree_add_item(rpc_tree,
hf_rpc_dup, tvb, 0,0, ENC_NA);
proto_item_set_generated(tmp_item);

View File

@ -561,9 +561,9 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboole
/* First, make sure we have enough data to do the check. */
captured_length = tvb_captured_length(tvb);
reported_length = tvb_reported_length(tvb);
if (captured_length < MIN_HDR_LEN)
return 0;
reported_length = tvb_reported_length(tvb);
tcp_framing_offset = 0;
if ((!is_udp) && (captured_length >= TCP_FRAME_COOKIE_LEN) &&

View File

@ -2578,16 +2578,13 @@ dissect_dch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* Dissect TB data */
offset = dissect_tb_data(tvb, pinfo, tree, offset, p_fp_info, &mac_fdd_dch_handle, data);
/* QE (uplink only) */
/* QE and CRCI bits (uplink only) */
if (p_fp_info->is_uplink) {
proto_tree_add_item(tree, hf_fp_quality_estimate, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
}
/* CRCI bits (uplink only) */
if (p_fp_info->is_uplink) {
offset = dissect_crci_bits(tvb, pinfo, tree, p_fp_info, offset);
}
if (preferences_header_checksum) {
verify_header_crc(tvb, pinfo, header_crc_pi, header_crc, header_length);
}
@ -4122,10 +4119,11 @@ heur_dissect_fp_dcch_over_dch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
/* Making sure we have at least enough bytes for header (3) + footer (2) */
captured_length = tvb_captured_length(tvb);
reported_length = tvb_reported_length(tvb);
if (captured_length < 5) {
return FALSE;
}
reported_length = tvb_reported_length(tvb);
tfi = tvb_get_guint8(tvb, 2) & 0x1f;
/* Checking if this is a DCH frame with 0 TBs*/

View File

@ -1441,6 +1441,10 @@ isup_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt,
callsinfo->call_state = VOIP_COMPLETED;
tapinfo->completed_calls++;
}
/* Overwrite any comment set above */
if (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)"));

View File

@ -1528,7 +1528,7 @@ reset_default_profile(char **pf_dir_path_return)
if (ret != 0) {
*pf_dir_path_return = profile_dir;
g_free(del_file);
return ret;
break;
}
}
@ -1538,7 +1538,7 @@ reset_default_profile(char **pf_dir_path_return)
g_list_free(files);
g_free(profile_dir);
return 0;
return ret;
}
int
@ -1694,6 +1694,7 @@ int
copy_persconffile_profile(const char *toname, const char *fromname, gboolean from_global,
char **pf_filename_return, char **pf_to_dir_path_return, char **pf_from_dir_path_return)
{
int ret = 0;
gchar *from_dir;
gchar *to_dir = get_persconffile_dir(toname);
gchar *filename, *from_file, *to_file;
@ -1714,7 +1715,8 @@ copy_persconffile_profile(const char *toname, const char *fromname, gboolean fro
*pf_from_dir_path_return = from_dir;
g_free (from_file);
g_free (to_file);
return -1;
ret = -1;
break;
}
g_free (from_file);
@ -1727,7 +1729,7 @@ copy_persconffile_profile(const char *toname, const char *fromname, gboolean fro
g_free (from_dir);
g_free (to_dir);
return 0;
return ret;
}
/*