1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

s3/lib/dwrap: clang: Fix 'Array access results in a null pointer dereference'

Fixes:

source3/lib/dbwrap/dbwrap_watch.c:55:3: warning: Array access (from variable 'wkey') results in a null pointer dereference <--[clang]
                SIVAL(wkey, 0, db_id_len);
                ^
1 warning generated.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
This commit is contained in:
Noel Power 2019-07-10 15:55:48 +01:00 committed by Gary Lockyer
parent 57e9b358ec
commit 0ca6d34a69

View File

@ -51,7 +51,7 @@ static ssize_t dbwrap_record_watchers_key(struct db_context *db,
return -1; return -1;
} }
if (wkey_len >= needed) { if (wkey != NULL && wkey_len >= needed) {
SIVAL(wkey, 0, db_id_len); SIVAL(wkey, 0, db_id_len);
memcpy(wkey + sizeof(uint32_t), db_id, db_id_len); memcpy(wkey + sizeof(uint32_t), db_id, db_id_len);
memcpy(wkey + sizeof(uint32_t) + db_id_len, memcpy(wkey + sizeof(uint32_t) + db_id_len,