]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib/dwrap: Fix 'Null pointer passed as an argument to a 'nonnull' parameter '
authorNoel Power <noel.power@suse.com>
Fri, 14 Jun 2019 13:40:28 +0000 (13:40 +0000)
committerNoel Power <npower@samba.org>
Wed, 26 Jun 2019 10:30:23 +0000 (10:30 +0000)
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 <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
lib/dbwrap/dbwrap.c

index 29815cb07afa0d02ec1bb8467c24d580405463d3..f8eefcca02d7460ad3598b7cb25519c26ca86561 100644 (file)
@@ -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;
                }