From 847103b787cfddf200c61d7d93fb57f993bdd976 Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Fri, 14 Aug 2015 22:21:24 +0100 Subject: [PATCH] Fix --dump-toc-raw option This option was reading the correct number of bytes but from the wrong starting offset within the xar file. The --dump-toc-raw option always read at least the first sizeof(xar_header_ex_t) bytes from the file before reading header.toc_length_compressed bytes of data for the TOC header. However, sizeof(xar_header_ex_t) is the _maximum_ possible size of the header. The minimum size is sizeof(xar_header_t). The option then reads any additional bytes needed to position the fd at header.size bytes from the beginning of the file. --- xar/src/xar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xar/src/xar.c b/xar/src/xar.c index f045f39..aad7fa6 100644 --- a/xar/src/xar.c +++ b/xar/src/xar.c @@ -1618,7 +1618,7 @@ static int dump_header(const char *filename) { static int dumptoc_raw(const char *filename, const char* tocfile) { int fd, toc; - xar_header_ex_t xh; + xar_header_t xh; uint64_t clen; uint16_t hlen; unsigned buffer_size = 4096;