summaryrefslogtreecommitdiff
path: root/source4/ntvfs
diff options
context:
space:
mode:
authorGary Lockyer <gary@catalyst.net.nz>2019-05-24 11:00:05 +1200
committerGary Lockyer <gary@samba.org>2019-05-27 01:29:48 +0000
commit412afb2aef100e09eb433b8f0cae064fc2a736b7 (patch)
tree2a3eedf4bbb4bc450d31652a7d765762237c4807 /source4/ntvfs
parentda87fa998ab71328f30bcdf5b41aee8675aee48a (diff)
downloadsamba-412afb2aef100e09eb433b8f0cae064fc2a736b7.tar.gz
Fix ubsan null pointer passed as argument 2
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): Gary Lockyer <gary@samba.org> Autobuild-Date(master): Mon May 27 01:29:48 UTC 2019 on sn-devel-184
Diffstat (limited to 'source4/ntvfs')
-rw-r--r--source4/ntvfs/common/brlock_tdb.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source4/ntvfs/common/brlock_tdb.c b/source4/ntvfs/common/brlock_tdb.c
index 56cf26c70b9..77a864af328 100644
--- a/source4/ntvfs/common/brlock_tdb.c
+++ b/source4/ntvfs/common/brlock_tdb.c
@@ -365,7 +365,9 @@ static NTSTATUS brl_tdb_lock(struct brl_context *brl,
status = NT_STATUS_NO_MEMORY;
goto fail;
}
- memcpy(locks, dbuf.dptr, dbuf.dsize);
+ if (dbuf.dsize > 0) {
+ memcpy(locks, dbuf.dptr, dbuf.dsize);
+ }
locks[count] = lock;
dbuf.dptr = (unsigned char *)locks;