aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--g10/plaintext.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/g10/plaintext.c b/g10/plaintext.c
index a1bbbd95f..5c21dd7f6 100644
--- a/g10/plaintext.c
+++ b/g10/plaintext.c
@@ -292,7 +292,22 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
else /* Binary mode. */
{
size_t temp_size = iobuf_set_buffer_size(0) * 1024;
- byte *buffer = xmalloc (temp_size);
+ byte *buffer;
+
+ if (fp)
+ {
+ /* Disable buffering in estream as we are passing large
+ * buffers to es_fwrite. */
+ es_setbuf (fp, NULL);
+ }
+
+ buffer = xmalloc (temp_size);
+ if (!buffer)
+ {
+ err = gpg_error_from_syserror ();
+ goto leave;
+ }
+
while (pt->len)
{
int len = pt->len > temp_size ? temp_size : pt->len;
@@ -371,6 +386,13 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
byte *buffer;
int eof_seen = 0;
+ if (fp)
+ {
+ /* Disable buffering in estream as we are passing large
+ * buffers to es_fwrite. */
+ es_setbuf (fp, NULL);
+ }
+
buffer = xtrymalloc (temp_size);
if (!buffer)
{