diff options
author | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2022-02-13 14:09:42 +0100 |
---|---|---|
committer | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2022-03-02 20:12:28 +0100 |
commit | 756c0bd5d89bd0a773f844fbc2ec508c1a36c63d (patch) | |
tree | 957cd27d98da1359457c2bc8f273568d2115db70 /g10 | |
parent | g10/dearmor: use iobuf_copy (diff) | |
download | gnupg2-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.c | 12 |
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. */ |