]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
dbwrap: Fix tdb_data_buf()
authorVolker Lendecke <vl@samba.org>
Fri, 3 May 2019 13:42:42 +0000 (15:42 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 8 May 2019 16:33:25 +0000 (16:33 +0000)
IIRC there are platforms that don't like memcpy() with len=0.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/dbwrap/dbwrap.c

index 79c83b1a5e25d8f280b0a9e472af9a9321d5423e..ff6c9224905fbdc3af85d9d72a4058afe28fa888 100644 (file)
@@ -643,7 +643,7 @@ static ssize_t tdb_data_buf(const TDB_DATA *dbufs, int num_dbufs,
                }
                needed = tmp;
 
-               if (needed <= buflen) {
+               if ((thislen != 0) && (needed <= buflen)) {
                        memcpy(p, dbufs[i].dptr, thislen);
                        p += thislen;
                }