aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2015-05-14 21:39:03 +0000
committerXin LI <delphij@FreeBSD.org>2015-05-14 21:39:03 +0000
commit5361c268d41ce92a3a5ff27d26edf986a3bf85d8 (patch)
tree29634f30108f140cd0029b2bc1e312b25a151ced
parent95b982db7d3f8e91e71382715ed9ae310114e796 (diff)
downloadsrc-5361c268d41ce92a3a5ff27d26edf986a3bf85d8.tar.gz
src-5361c268d41ce92a3a5ff27d26edf986a3bf85d8.zip
Apply upstream changeset 24f5de6:
Set a proper error message if we hit end-of-file when trying to read a cpio header. Suggested by Issue #395, although the actual problem there seems to have been the same as Issue #394.
Notes
Notes: svn path=/vendor/libarchive/dist/; revision=282930
-rw-r--r--libarchive/archive_read_support_format_cpio.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libarchive/archive_read_support_format_cpio.c b/libarchive/archive_read_support_format_cpio.c
index 4a0452ddf7ca..1dabc4786d28 100644
--- a/libarchive/archive_read_support_format_cpio.c
+++ b/libarchive/archive_read_support_format_cpio.c
@@ -864,8 +864,11 @@ header_bin_le(struct archive_read *a, struct cpio *cpio,
/* Read fixed-size portion of header. */
h = __archive_read_ahead(a, bin_header_size, NULL);
- if (h == NULL)
+ if (h == NULL) {
+ archive_set_error(&a->archive, 0,
+ "End of file trying to read next cpio header");
return (ARCHIVE_FATAL);
+ }
/* Parse out binary fields. */
header = (const unsigned char *)h;
@@ -900,8 +903,11 @@ header_bin_be(struct archive_read *a, struct cpio *cpio,
/* Read fixed-size portion of header. */
h = __archive_read_ahead(a, bin_header_size, NULL);
- if (h == NULL)
+ if (h == NULL) {
+ archive_set_error(&a->archive, 0,
+ "End of file trying to read next cpio header");
return (ARCHIVE_FATAL);
+ }
/* Parse out binary fields. */
header = (const unsigned char *)h;