diff options
author | NIIBE Yutaka <[email protected]> | 2021-08-27 07:55:25 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2021-08-27 08:22:25 +0000 |
commit | 7e431e009e479e63f0996a612e12fb9d8b209ab9 (patch) | |
tree | 0d4be7678c8c38eeee5075991310188065699222 | |
parent | build: Fix removal of AC_TYPE_SIGNAL. (diff) | |
download | gnupg-7e431e009e479e63f0996a612e12fb9d8b209ab9.tar.gz gnupg-7e431e009e479e63f0996a612e12fb9d8b209ab9.zip |
common: Fix put_membuf.
* common/membuf.c (put_membuf): Allow NULL for the second arg.
--
Cherry-picked from master commit of:
f271c6916469c0054c143adb4cee0588866a2a61
There has been such a use case in keybox-blob.c.
Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r-- | common/membuf.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/common/membuf.c b/common/membuf.c index 18a971d54..009fbc336 100644 --- a/common/membuf.c +++ b/common/membuf.c @@ -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; } |