From fd17d50f7cb8747c66e64e788bbd45212410d9c7 Mon Sep 17 00:00:00 2001 From: Noel Power Date: Fri, 14 Jun 2019 13:40:28 +0000 Subject: [PATCH] lib/dwrap: Fix 'Null pointer passed as an argument to a 'nonnull' parameter ' Fixes: lib/dbwrap/dbwrap.c:645:4: warning: Null pointer passed as an argument to a 'nonnull' parameter <--[clang] memcpy(p, dbufs[i].dptr, thislen); Signed-off-by: Noel Power Reviewed-by: Gary Lockyer --- lib/dbwrap/dbwrap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dbwrap/dbwrap.c b/lib/dbwrap/dbwrap.c index 29815cb07af..f8eefcca02d 100644 --- a/lib/dbwrap/dbwrap.c +++ b/lib/dbwrap/dbwrap.c @@ -642,7 +642,7 @@ static ssize_t tdb_data_buf(const TDB_DATA *dbufs, int num_dbufs, return -1; } - if ((thislen != 0) && (needed <= buflen)) { + if (p != NULL && (thislen != 0) && (needed <= buflen)) { memcpy(p, dbufs[i].dptr, thislen); p += thislen; } -- 2.47.2