From 0ca6d34a69d308ad756f3697f8f44a8e642b27f0 Mon Sep 17 00:00:00 2001 From: Noel Power Date: Wed, 10 Jul 2019 15:55:48 +0100 Subject: [PATCH] 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 Reviewed-by: Gary Lockyer --- source3/lib/dbwrap/dbwrap_watch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/lib/dbwrap/dbwrap_watch.c b/source3/lib/dbwrap/dbwrap_watch.c index 9bf3d372621..6bbd68df859 100644 --- a/source3/lib/dbwrap/dbwrap_watch.c +++ b/source3/lib/dbwrap/dbwrap_watch.c @@ -51,7 +51,7 @@ static ssize_t dbwrap_record_watchers_key(struct db_context *db, return -1; } - if (wkey_len >= needed) { + if (wkey != NULL && wkey_len >= needed) { SIVAL(wkey, 0, db_id_len); memcpy(wkey + sizeof(uint32_t), db_id, db_id_len); memcpy(wkey + sizeof(uint32_t) + db_id_len, -- 2.47.3