mirror of
git://git.gnupg.org/gnupg.git
synced 2024-11-10 21:38:50 +01:00
gpg: Improve detection of input data read errors.
* g10/build-packet.c (do_plaintext): Better error checking for
iobuf_copy.
--
Fixes-commit: 2fdb950471
GnuPG-bug-id: 6528
The original fix handles only the disk full case but didn't bother
about read errors (i.e. I/O problems on an external drive).
This commit is contained in:
parent
e16728f3d6
commit
178c3fe62c
@ -993,9 +993,16 @@ do_plaintext( IOBUF out, int ctb, PKT_plaintext *pt )
|
|||||||
if (nbytes == (size_t)(-1)
|
if (nbytes == (size_t)(-1)
|
||||||
&& (iobuf_error (out) || iobuf_error (pt->buf)))
|
&& (iobuf_error (out) || iobuf_error (pt->buf)))
|
||||||
return iobuf_error (out)? iobuf_error (out):iobuf_error (pt->buf);
|
return iobuf_error (out)? iobuf_error (out):iobuf_error (pt->buf);
|
||||||
/* Always get the error to catch write errors because
|
else if (nbytes != (size_t)(-1) && iobuf_error (pt->buf))
|
||||||
* iobuf_copy does not reliable return (-1) in that case. */
|
rc = iobuf_error (pt->buf); /* Read error. */
|
||||||
rc = iobuf_error (out);
|
else
|
||||||
|
{
|
||||||
|
/* Always get the iobuf error to catch write errors
|
||||||
|
* because iobuf_copy returns (-1) only if there was a
|
||||||
|
* errors in the output stream when entering that
|
||||||
|
* function. */
|
||||||
|
rc = iobuf_error (out);
|
||||||
|
}
|
||||||
if(ctb_new_format_p (ctb) && !pt->len)
|
if(ctb_new_format_p (ctb) && !pt->len)
|
||||||
/* Turn off partial body length mode. */
|
/* Turn off partial body length mode. */
|
||||||
iobuf_set_partial_body_length_mode (out, 0);
|
iobuf_set_partial_body_length_mode (out, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user