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 = wmem_new(wmem_file_scope(), struct beep_request_key);
new_request_key->conversation = conversation->conv_index; new_request_key->conversation = conversation->conv_index;
request_val = wmem_new(wmem_file_scope(), struct beep_request_val); request_val = wmem_new0(wmem_file_scope(), struct beep_request_val);
request_val->processed = 0;
request_val->size = 0;
wmem_map_insert(beep_request_hash, new_request_key, 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; int offset = 0;
tvbuff_t *next_tvb; tvbuff_t *next_tvb;
guint32 msg_disc, len, ack_data_ind, cs, fn; 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"); 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[] = static const value_string rohc_ip_version_vals[] =
{ {
{ 0, "Unknown" },
{ 4, "IPv4" }, { 4, "IPv4" },
{ 6, "IPv6" }, { 6, "IPv6" },
{ 0, NULL }, { 0, NULL },
@ -2468,7 +2469,7 @@ dissect_rohc_ir_packet(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo,
} else { } else {
rohc_cid_context = wmem_new(wmem_file_scope(), rohc_cid_context_t); 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->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->d_mode;*/
rohc_cid_context->rnd = FALSE; rohc_cid_context->rnd = FALSE;
rohc_cid_context->udp_checksum_present = 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); p_add_proto_data(wmem_file_scope(), pinfo, proto_rohc, 0, rohc_cid_context);
} else { } else {
rohc_cid_context = wmem_new(wmem_file_scope(), rohc_cid_context_t); 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->large_cid_present = p_rohc_info->large_cid_present;
/*rohc_cid_context->mode mode;*/
/*rohc_cid_context->d_mode;*/ /*rohc_cid_context->d_mode;*/
rohc_cid_context->rnd = FALSE; rohc_cid_context->rnd = FALSE;
rohc_cid_context->udp_checksum_present = 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; guint8 *dpos;
int skip, l; int skip, l;
if(len>=MAX_KRB5_BLOB_LEN) if(len >= MAX_KRB5_BLOB_LEN)
return NULL; return NULL;
spos=tvb_get_ptr(tvb, offset, len); spos = tvb_get_ptr(tvb, offset, len);
buf=(guint8 *)wmem_alloc(pinfo->pool, len); const guint8 *last_src_pos = spos + len - 1;
dpos=buf; buf = (guint8 *)wmem_alloc(pinfo->pool, len);
skip=0; dpos = buf;
l=len; skip = 0;
while(l>0){ l = len;
if((spos[0]==0xff) && (spos[1]==0xff)){ while(l > 0) {
// XXX Add expert info if spos >= last_src_pos?
if(spos < last_src_pos && (spos[0] == 0xff) && (spos[1] == 0xff)) {
skip++; skip++;
l-=2; l -= 2;
*(dpos++)=0xff; *(dpos++) = 0xff;
spos+=2; spos += 2;
continue; continue;
} }
*(dpos++)=*(spos++); *(dpos++) = *(spos++);
l--; l--;
} }
krb5_tvb = tvb_new_child_real_data(tvb, buf, len-skip, len-skip); krb5_tvb = tvb_new_child_real_data(tvb, buf, len-skip, len-skip);