summaryrefslogtreecommitdiffstats
path: root/g10
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
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')
-rw-r--r--g10/build-packet.c3
-rw-r--r--g10/encrypt.c3
2 files changed, 5 insertions, 1 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);
diff --git a/g10/encrypt.c b/g10/encrypt.c
index bd98d06e4..7218de216 100644
--- a/g10/encrypt.c
+++ b/g10/encrypt.c
@@ -1060,6 +1060,8 @@ encrypt_filter (void *opaque, int control,
{
if ( !efx->header_okay )
{
+ efx->header_okay = 1;
+
efx->cfx.dek = create_dek_with_warnings (efx->pk_list);
rc = check_encryption_compliance (efx->cfx.dek, efx->pk_list);
@@ -1092,7 +1094,6 @@ encrypt_filter (void *opaque, int control,
/**/ : cipher_filter_cfb,
&efx->cfx);
- efx->header_okay = 1;
}
rc = iobuf_write (a, buf, size);