common: Check for an error before reading.
authorNeal H. Walfield <neal@g10code.com>
Tue, 23 Feb 2016 20:04:29 +0000 (21:04 +0100)
committerNeal H. Walfield <neal@g10code.com>
Tue, 23 Feb 2016 20:04:29 +0000 (21:04 +0100)
* common/iobuf.c (iobuf_copy): If DEST has a pending error, don't
start copying.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
common/iobuf.c

index 6a9060a..1f2cd3f 100644 (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)
     {