SMB2: ensure that preauth_hash_current pointer is always initialized

Bug: 15446
Change-Id: I9c233ee327dd40d1ae2dd076a2e236c6f23ae5e2
Reviewed-on: https://code.wireshark.org/review/31741
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
This commit is contained in:
Pascal Quantin 2019-01-25 18:29:34 +01:00
parent 6fbf28f3b8
commit 14d5ab01c0
1 changed files with 2 additions and 4 deletions

View File

@ -4516,9 +4516,6 @@ dissect_smb2_negotiate_protocol_request(tvbuff_t *tvb, packet_info *pinfo, proto
/* compute preauth hash on first pass */
if (!pinfo->fd->visited && ssi) {
ssi->preauth_hash_req = (guint8*)wmem_alloc0(wmem_file_scope(), SMB2_PREAUTH_HASH_SIZE);
memset(si->conv->preauth_hash_ses, 0, SMB2_PREAUTH_HASH_SIZE);
memset(si->conv->preauth_hash_con, 0, SMB2_PREAUTH_HASH_SIZE);
si->conv->preauth_hash_current = si->conv->preauth_hash_con;
update_preauth_hash(si->conv->preauth_hash_current, tvb);
memcpy(ssi->preauth_hash_req, si->conv->preauth_hash_current, SMB2_PREAUTH_HASH_SIZE);
}
@ -9308,7 +9305,7 @@ dissect_smb2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, gboolea
/* no smb2_into_t structure for this conversation yet,
* create it.
*/
si->conv = wmem_new(wmem_file_scope(), smb2_conv_info_t);
si->conv = wmem_new0(wmem_file_scope(), smb2_conv_info_t);
/* qqq this leaks memory for now since we never free
the hashtables */
si->conv->matched = g_hash_table_new(smb2_saved_info_hash_matched,
@ -9320,6 +9317,7 @@ dissect_smb2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, gboolea
si->conv->fids = g_hash_table_new(smb2_fid_info_hash,
smb2_fid_info_equal);
si->conv->files = g_hash_table_new(smb2_eo_files_hash,smb2_eo_files_equal);
si->conv->preauth_hash_current = si->conv->preauth_hash_con;
/* Bit of a hack to avoid leaking the hash tables - register a
* callback to free them. Ideally wmem would implement a simple