summaryrefslogtreecommitdiff
path: root/libarchive/archive_write_set_format_xar.c
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@gmail.com>2010-06-04 21:51:47 -0400
committerTim Kientzle <kientzle@gmail.com>2010-06-04 21:51:47 -0400
commit5de7cbb23280c2cc85eeddb7fc0a4de5dda7d4eb (patch)
treead745ee8c6d02605f1f4a6072506c3fe32607ff1 /libarchive/archive_write_set_format_xar.c
parentaa2963829a7c8568dfa55273c11c220d9dd7075e (diff)
downloadlibarchive-5de7cbb23280c2cc85eeddb7fc0a4de5dda7d4eb.tar.gz
If the temporary file gets truncated for any reason, die
instead of getting stuck in an infinite loop. SVN-Revision: 2444
Diffstat (limited to 'libarchive/archive_write_set_format_xar.c')
-rw-r--r--libarchive/archive_write_set_format_xar.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libarchive/archive_write_set_format_xar.c b/libarchive/archive_write_set_format_xar.c
index ebcd0932..28292d27 100644
--- a/libarchive/archive_write_set_format_xar.c
+++ b/libarchive/archive_write_set_format_xar.c
@@ -1733,6 +1733,11 @@ copy_out(struct archive_write *a, uint64_t offset, uint64_t length)
(intmax_t)rs);
return (ARCHIVE_FATAL);
}
+ if (rs == 0) {
+ archive_set_error(&(a->archive), 0,
+ "Truncated xar archive");
+ return (ARCHIVE_FATAL);
+ }
xar->wbuff_remaining -= rs;
length -= rs;
if (xar->wbuff_remaining == 0) {