diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2021-08-27 09:55:25 +0200 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2021-08-27 09:55:25 +0200 |
commit | f271c6916469c0054c143adb4cee0588866a2a61 (patch) | |
tree | 8648aa14b3cd66d9e5134044f9a553706f65d9b8 /common/membuf.c | |
parent | common: Fix get_signal_name for GNU/Linux. (diff) | |
download | gnupg2-f271c6916469c0054c143adb4cee0588866a2a61.tar.xz gnupg2-f271c6916469c0054c143adb4cee0588866a2a61.zip |
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>
Diffstat (limited to '')
-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; } |