common: Check for an error before reading.

* common/iobuf.c (iobuf_copy): If DEST has a pending error, don't
start copying.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
This commit is contained in:
Neal H. Walfield 2016-02-23 21:04:29 +01:00
parent 903466e124
commit 8066f8a347
1 changed files with 3 additions and 0 deletions

View File

@ -2237,6 +2237,9 @@ iobuf_copy (iobuf_t dest, iobuf_t source)
assert (source->use == IOBUF_INPUT || source->use == IOBUF_INPUT_TEMP);
assert (dest->use == IOBUF_OUTPUT || source->use == IOBUF_OUTPUT_TEMP);
if (iobuf_error (dest))
return -1;
temp = xmalloc (temp_size);
while (1)
{