1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

common: Fix put_membuf.

* common/membuf.c (put_membuf): Allow NULL for the second arg.

--

There has been such a use case in keybox-blob.c.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2021-08-27 16:55:25 +09:00
parent c4ba712736
commit f271c69164

View File

@ -111,7 +111,10 @@ put_membuf (membuf_t *mb, const void *buf, size_t len)
}
mb->buf = p;
}
memcpy (mb->buf + mb->len, buf, len);
if (buf)
memcpy (mb->buf + mb->len, buf, len);
else
memset (mb->buf + mb->len, 0, len);
mb->len += len;
}