epan: Initialize variables in various dissectors

Fix the following valgrind warnings:

==15172== Conditional jump or move depends on uninitialised value(s)
==15172==    at 0x78B0849: unescape_and_tvbuffify_telnet_option (epan/dissectors/packet-telnet.c:1043)

==15172== Conditional jump or move depends on uninitialised value(s)
==15172==    at 0x76917C8: dissect_rohc_ir_rtp_profile_dynamic (epan/dissectors/packet-rohc.c:1667)

==15172== Conditional jump or move depends on uninitialised value(s)
==15172==    at 0x70DCBF1: dissect_gsm_rlcmac_downlink (epan/dissectors/packet-gsm_rlcmac.c:9770)

==15172== Conditional jump or move depends on uninitialised value(s)
==15172==    at 0x6C7958E: set_mime_hdr_flags (epan/dissectors/packet-beep.c:392)

Fixes #18742
This commit is contained in:
Gerald Combs 2022-12-27 12:57:14 -08:00
parent af22c743bd
commit afe5ed0aa5
4 changed files with 19 additions and 19 deletions

View File

@ -759,9 +759,7 @@ dissect_beep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
new_request_key = wmem_new(wmem_file_scope(), struct beep_request_key);
new_request_key->conversation = conversation->conv_index;
request_val = wmem_new(wmem_file_scope(), struct beep_request_val);
request_val->processed = 0;
request_val->size = 0;
request_val = wmem_new0(wmem_file_scope(), struct beep_request_val);
wmem_map_insert(beep_request_hash, new_request_key, request_val);

View File

@ -391,7 +391,7 @@ dissect_abis_pgsl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
int offset = 0;
tvbuff_t *next_tvb;
guint32 msg_disc, len, ack_data_ind, cs, fn;
RlcMacPrivateData_t rlcmac_data;
RlcMacPrivateData_t rlcmac_data = {0};
col_set_str(pinfo->cinfo, COL_PROTOCOL, "P-GSL");

View File

@ -298,6 +298,7 @@ static const value_string rohc_opt_type_vals[] =
static const value_string rohc_ip_version_vals[] =
{
{ 0, "Unknown" },
{ 4, "IPv4" },
{ 6, "IPv6" },
{ 0, NULL },
@ -2468,7 +2469,7 @@ dissect_rohc_ir_packet(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo,
} else {
rohc_cid_context = wmem_new(wmem_file_scope(), rohc_cid_context_t);
rohc_cid_context->large_cid_present = p_rohc_info->large_cid_present;
/*rohc_cid_context->mode mode;*/
rohc_cid_context->mode = 0;
/*rohc_cid_context->d_mode;*/
rohc_cid_context->rnd = FALSE;
rohc_cid_context->udp_checksum_present = FALSE;
@ -2592,9 +2593,8 @@ dissect_rohc_ir_dyn_packet(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo,
p_add_proto_data(wmem_file_scope(), pinfo, proto_rohc, 0, rohc_cid_context);
} else {
rohc_cid_context = wmem_new(wmem_file_scope(), rohc_cid_context_t);
/*rohc_cid_context->rohc_ip_version;*/
rohc_cid_context->rohc_ip_version = 0;
rohc_cid_context->large_cid_present = p_rohc_info->large_cid_present;
/*rohc_cid_context->mode mode;*/
/*rohc_cid_context->d_mode;*/
rohc_cid_context->rnd = FALSE;
rohc_cid_context->udp_checksum_present = FALSE;

View File

@ -1031,23 +1031,25 @@ unescape_and_tvbuffify_telnet_option(packet_info *pinfo, tvbuff_t *tvb, int offs
guint8 *dpos;
int skip, l;
if(len>=MAX_KRB5_BLOB_LEN)
if(len >= MAX_KRB5_BLOB_LEN)
return NULL;
spos=tvb_get_ptr(tvb, offset, len);
buf=(guint8 *)wmem_alloc(pinfo->pool, len);
dpos=buf;
skip=0;
l=len;
while(l>0){
if((spos[0]==0xff) && (spos[1]==0xff)){
spos = tvb_get_ptr(tvb, offset, len);
const guint8 *last_src_pos = spos + len - 1;
buf = (guint8 *)wmem_alloc(pinfo->pool, len);
dpos = buf;
skip = 0;
l = len;
while(l > 0) {
// XXX Add expert info if spos >= last_src_pos?
if(spos < last_src_pos && (spos[0] == 0xff) && (spos[1] == 0xff)) {
skip++;
l-=2;
*(dpos++)=0xff;
spos+=2;
l -= 2;
*(dpos++) = 0xff;
spos += 2;
continue;
}
*(dpos++)=*(spos++);
*(dpos++) = *(spos++);
l--;
}
krb5_tvb = tvb_new_child_real_data(tvb, buf, len-skip, len-skip);