DCOM: always NUL-terminate dissect_dcom_BSTR results

All of the six users in plugins/epan/profinet/packet-dcom-cba.c expect
the string to be NUL-terminated, so ensure this to avoid reading
uninitialized memory for the Info column.

Bug: 15130
Change-Id: Ibc922068d14b87ce324af3cec22a5f8343088b40
Reviewed-on: https://code.wireshark.org/review/30128
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Peter Wu 2018-10-11 13:04:03 +02:00 committed by Anders Broman
parent f4be16aa45
commit ec6ace066a
1 changed files with 3 additions and 1 deletions

View File

@ -1725,8 +1725,10 @@ dissect_dcom_BSTR(tvbuff_t *tvb, gint offset, packet_info *pinfo,
offset = dissect_dcom_dcerpc_array_size(tvb, offset, pinfo, sub_tree, di, drep,
&u32ArraySize);
if ((guint32)offset + u32ArraySize*2 > G_MAXINT)
if ((guint32)offset + u32ArraySize*2 > G_MAXINT) {
pszStr[0] = 0;
return offset;
}
realOffset = offset + u32ArraySize*2;