From: Noel Power Date: Wed, 3 Jul 2019 11:10:44 +0000 (+0000) Subject: lib/util: clang: Fix 'Null pointer passed as an argument' X-Git-Tag: samba-4.11.0rc1~25 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d759f4aa4b8e660e0745cfed30eb291d9484291d;p=thirdparty%2Fsamba.git lib/util: clang: Fix 'Null pointer passed as an argument' Fixes lib/util/iov_buf.c:50:4: warning: Null pointer passed as an argument to a 'nonnull' parameter <--[clang] memcpy(p, iov[i].iov_base, thislen); ^ 1 warning generated. Signed-off-by: Noel Power Reviewed-by: Gary Lockyer --- diff --git a/lib/util/iov_buf.c b/lib/util/iov_buf.c index 132c7a75637..a9224164068 100644 --- a/lib/util/iov_buf.c +++ b/lib/util/iov_buf.c @@ -46,7 +46,7 @@ ssize_t iov_buf(const struct iovec *iov, int iovcnt, } needed = tmp; - if (needed <= buflen && thislen > 0) { + if ((p != NULL) && needed <= buflen && thislen > 0) { memcpy(p, iov[i].iov_base, thislen); p += thislen; }