From 52d696a0c3359aba88f7eb85cbb06ddddf56cf97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sun, 24 Nov 2013 04:38:36 +0100 Subject: [PATCH] tar2qfile: fix padding handling --- qubes-rpc/tar2qfile.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qubes-rpc/tar2qfile.c b/qubes-rpc/tar2qfile.c index 34be38e..afd1da8 100644 --- a/qubes-rpc/tar2qfile.c +++ b/qubes-rpc/tar2qfile.c @@ -756,8 +756,8 @@ ustar_rd (int fd, struct file_header * untrusted_hdr, char *buf, struct stat * s } } // Extract extra padding - fprintf(stderr,"Need to remove pad:%ld %ld\n",untrusted_hdr->filelen,BLKMULT-(untrusted_hdr->filelen%BLKMULT)); - if (untrusted_hdr->filelen%BLKMULT < BLKMULT) + fprintf(stderr,"Need to remove pad:%lld %lld\n",untrusted_hdr->filelen,BLKMULT-(untrusted_hdr->filelen%BLKMULT)); + if (untrusted_hdr->filelen%BLKMULT > 0) ret = read(fd, buf, BLKMULT-(untrusted_hdr->filelen%BLKMULT)); fprintf(stderr,"Removed %d bytes of padding\n",ret); @@ -844,8 +844,8 @@ void tar_file_processor(int fd, struct filters *filters) } // Extract extra padding - fprintf(stderr,"Need to remove pad:%ld %ld %ld\n",to_skip,hdr.filelen,BLKMULT-(hdr.filelen%BLKMULT)); - if (hdr.filelen%BLKMULT < BLKMULT) { + fprintf(stderr,"Need to remove pad:%ld %lld %lld\n",to_skip,hdr.filelen,BLKMULT-(hdr.filelen%BLKMULT)); + if (hdr.filelen%BLKMULT > 0) { ret = read(fd, &buf, BLKMULT-(hdr.filelen%BLKMULT)); fprintf(stderr,"Removed %d bytes of padding\n",ret); }