From: Noel Power Date: Wed, 10 Jul 2019 14:55:48 +0000 (+0100) Subject: s3/lib/dwrap: clang: Fix 'Array access results in a null pointer dereference' X-Git-Tag: talloc-2.3.0~86 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0ca6d34a69d308ad756f3697f8f44a8e642b27f0;p=thirdparty%2Fsamba.git 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 --- 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,