diff options
author | Werner Koch <wk@gnupg.org> | 2022-08-31 13:35:41 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2022-09-29 15:09:56 +0200 |
commit | 46f9b0071f54191cbf05ae23b24961ac6f43de4e (patch) | |
tree | bafad4ed0f8d8167fd37c3acb31d663879507010 /common | |
parent | gpg: Make --require-compliance work for -se (diff) | |
download | gnupg2-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 'common')
-rw-r--r-- | common/iobuf.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/common/iobuf.c b/common/iobuf.c index c88d67908..3ec64dc57 100644 --- a/common/iobuf.c +++ b/common/iobuf.c @@ -2430,7 +2430,7 @@ iobuf_temp_to_buffer (iobuf_t a, byte * buffer, size_t buflen) /* Copies the data from the input iobuf SOURCE to the output iobuf DEST until either an error is encountered or EOF is reached. - Returns the number of bytes copies. */ + Returns the number of bytes copies or (size_t)(-1) on error. */ size_t iobuf_copy (iobuf_t dest, iobuf_t source) { @@ -2441,11 +2441,11 @@ iobuf_copy (iobuf_t dest, iobuf_t source) size_t max_read = 0; int err; - assert (source->use == IOBUF_INPUT || source->use == IOBUF_INPUT_TEMP); - assert (dest->use == IOBUF_OUTPUT || source->use == IOBUF_OUTPUT_TEMP); + log_assert (source->use == IOBUF_INPUT || source->use == IOBUF_INPUT_TEMP); + log_assert (dest->use == IOBUF_OUTPUT || source->use == IOBUF_OUTPUT_TEMP); if (iobuf_error (dest)) - return -1; + return (size_t)(-1); /* Use iobuf buffer size for temporary buffer. */ temp_size = iobuf_set_buffer_size(0) * 1024; |