summaryrefslogtreecommitdiffstats
path: root/g10/build-packet.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2022-08-31 13:35:41 +0200
committerWerner Koch <wk@gnupg.org>2022-09-29 15:09:56 +0200
commit46f9b0071f54191cbf05ae23b24961ac6f43de4e (patch)
treebafad4ed0f8d8167fd37c3acb31d663879507010 /g10/build-packet.c
parentgpg: Make --require-compliance work for -se (diff)
downloadgnupg2-46f9b0071f54191cbf05ae23b24961ac6f43de4e.tar.xz
gnupg2-46f9b0071f54191cbf05ae23b24961ac6f43de4e.zip
gpg: Fix assertion failure due to errors in encrypt_filter.
* common/iobuf.c (iobuf_copy): Use log_assert. Explicitly cast error return value. * g10/build-packet.c (do_plaintext): Check for iobuf_copy error. * g10/encrypt.c (encrypt_filter): Immediately set header_okay. -- The second fix avoids repeated error message about non-compliant keys. Updates-commit: a51067a21f688086bd8e44234a88ae367582cc76 Ported-from: aa0c942521d89f4f0aac90bacaf8a7a7cefc88d8 GnuPG-bug-id: 6174
Diffstat (limited to 'g10/build-packet.c')
-rw-r--r--g10/build-packet.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/g10/build-packet.c b/g10/build-packet.c
index a631db8d8..cc953557d 100644
--- a/g10/build-packet.c
+++ b/g10/build-packet.c
@@ -970,6 +970,9 @@ do_plaintext( IOBUF out, int ctb, PKT_plaintext *pt )
if (pt->buf)
{
nbytes = iobuf_copy (out, pt->buf);
+ if (nbytes == (size_t)(-1)
+ && (iobuf_error (out) || iobuf_error (pt->buf)))
+ return iobuf_error (out)? iobuf_error (out):iobuf_error (pt->buf);
if(ctb_new_format_p (ctb) && !pt->len)
/* Turn off partial body length mode. */
iobuf_set_partial_body_length_mode (out, 0);