diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2022-04-25 10:37:32 +0200 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2022-04-25 10:37:32 +0200 |
commit | 2fc91e15c6bebb203162cc8445e68ee4ff934885 (patch) | |
tree | 3f1da420cebe8f7f25dc481c1001a39e27be3e35 | |
parent | scd: Fix hard-coded constant for RSA auth. (diff) | |
download | gnupg2-2fc91e15c6bebb203162cc8445e68ee4ff934885.tar.xz gnupg2-2fc91e15c6bebb203162cc8445e68ee4ff934885.zip |
common:iobuf: Exclude cases with IOBUF_INPUT_TEMP/IOBUF_OUTPUT_TEMP.
* common/iobuf.c (iobuf_read): Handle a case with IOBUF_INPUT_TEMP.
(iobuf_write): Handle a case with IOBUF_OUTPUT_TEMP.
--
GnuPG-bug-id: 5941
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
-rw-r--r-- | common/iobuf.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/common/iobuf.c b/common/iobuf.c index 8ec4c86c0..05486b976 100644 --- a/common/iobuf.c +++ b/common/iobuf.c @@ -2177,7 +2177,8 @@ iobuf_read (iobuf_t a, void *buffer, unsigned int buflen) a->e_d.len = 0; /* Hint for how full to fill iobuf internal drain buffer. */ - a->e_d.preferred = (buf && buflen >= IOBUF_ZEROCOPY_THRESHOLD_SIZE); + a->e_d.preferred = (a->use != IOBUF_INPUT_TEMP) + && (buf && buflen >= IOBUF_ZEROCOPY_THRESHOLD_SIZE); n = 0; do @@ -2200,7 +2201,7 @@ iobuf_read (iobuf_t a, void *buffer, unsigned int buflen) underflow to read more data into the filter's internal buffer. */ { - if (buf && n < buflen) + if (a->use != IOBUF_INPUT_TEMP && buf && n < buflen) { /* Setup external drain buffer for faster moving of data * (avoid memcpy). */ @@ -2328,11 +2329,13 @@ iobuf_write (iobuf_t a, const void *buffer, unsigned int buflen) a->e_d.len = 0; /* Hint for how full to fill iobuf internal drain buffer. */ - a->e_d.preferred = (buflen >= IOBUF_ZEROCOPY_THRESHOLD_SIZE); + a->e_d.preferred = (a->use != IOBUF_OUTPUT_TEMP) + && (buflen >= IOBUF_ZEROCOPY_THRESHOLD_SIZE); do { - if (a->d.len == 0 && buflen >= IOBUF_ZEROCOPY_THRESHOLD_SIZE) + if ((a->use != IOBUF_OUTPUT_TEMP) + && a->d.len == 0 && buflen >= IOBUF_ZEROCOPY_THRESHOLD_SIZE) { /* Setup external drain buffer for faster moving of data * (avoid memcpy). */ |