summaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@iki.fi>2022-02-13 14:09:42 +0100
committerJussi Kivilinna <jussi.kivilinna@iki.fi>2022-03-02 20:12:28 +0100
commit756c0bd5d89bd0a773f844fbc2ec508c1a36c63d (patch)
tree957cd27d98da1359457c2bc8f273568d2115db70 /g10
parentg10/dearmor: use iobuf_copy (diff)
downloadgnupg2-756c0bd5d89bd0a773f844fbc2ec508c1a36c63d.tar.xz
gnupg2-756c0bd5d89bd0a773f844fbc2ec508c1a36c63d.zip
g10/encrypt: use iobuf_copy instead of manual iobuf_read/iobuf_write
* g10/encrypt.c (encrypt_simple): Use 'iobuf_copy' for no-literal case. -- GnuPG-bug-id: T5852 Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'g10')
-rw-r--r--g10/encrypt.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/g10/encrypt.c b/g10/encrypt.c
index d9af54ae6..bca7344f4 100644
--- a/g10/encrypt.c
+++ b/g10/encrypt.c
@@ -497,15 +497,9 @@ encrypt_simple (const char *filename, int mode, int use_seskey)
{
/* User requested not to create a literal packet, so we copy the
plain data. */
- byte copy_buffer[4096];
- int bytes_copied;
- while ((bytes_copied = iobuf_read(inp, copy_buffer, 4096)) != -1)
- if ( (rc=iobuf_write(out, copy_buffer, bytes_copied)) ) {
- log_error ("copying input to output failed: %s\n",
- gpg_strerror (rc) );
- break;
- }
- wipememory (copy_buffer, 4096); /* burn buffer */
+ rc = iobuf_copy (out, inp);
+ if (rc)
+ log_error ("copying input to output failed: %s\n", gpg_strerror (rc));
}
/* Finish the stuff. */