1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

libcli smb smb1cli_trans: fix ubsan warning

Fix ubsan warning null pointer passed as argument 2 when the source
pointer is NULL.  The calls to memcpy are now guarded by an
if (len > 0)

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Oct 16 18:00:31 UTC 2019 on sn-devel-184
This commit is contained in:
Gary Lockyer 2019-06-06 08:40:42 +12:00 committed by Andreas Schneider
parent 50cce842a2
commit aed4d06376

View File

@ -351,8 +351,10 @@ static void smb1cli_trans_format(struct smb1cli_trans_state *state,
SSVAL(vwv +12, 0, data_offset);
SCVAL(vwv +13, 0, state->num_setup);
SCVAL(vwv +13, 1, 0); /* reserved */
memcpy(vwv + 14, state->setup,
sizeof(uint16_t) * state->num_setup);
if (state->num_setup > 0) {
memcpy(vwv + 14, state->setup,
sizeof(uint16_t) * state->num_setup);
}
break;
case SMBtranss:
case SMBtranss2: