diff options
author | Tim Kientzle <kientzle@acm.org> | 2015-02-06 22:07:16 -0800 |
---|---|---|
committer | Tim Kientzle <kientzle@acm.org> | 2015-02-06 22:07:16 -0800 |
commit | 24f5de6560f31a67bfdf5ddec367e70ecfa9e440 (patch) | |
tree | f0df35653a9a28c26ef2eef5617eab55a82e811e /libarchive/archive_read_support_format_cpio.c | |
parent | bc6710e0fc73990043ab3ea94f6c9ec75b924277 (diff) | |
download | libarchive-24f5de6560f31a67bfdf5ddec367e70ecfa9e440.tar.gz |
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.
Diffstat (limited to 'libarchive/archive_read_support_format_cpio.c')
-rw-r--r-- | libarchive/archive_read_support_format_cpio.c | 10 |
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 e7b3d0c1..c2ca85bd 100644 --- a/libarchive/archive_read_support_format_cpio.c +++ b/libarchive/archive_read_support_format_cpio.c @@ -866,8 +866,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; @@ -902,8 +905,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; |