From d4112005d25c388b3cc815514e948a095b8c779e Mon Sep 17 00:00:00 2001 From: Nigel Horne Date: Sat, 16 Oct 2004 16:08:46 +0000 Subject: [PATCH] Handle empty files in the middle of archives git-svn: trunk@1008 --- clamav-devel/libclamav/untar.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/clamav-devel/libclamav/untar.c b/clamav-devel/libclamav/untar.c index a25f8f873..8811797ed 100644 --- a/clamav-devel/libclamav/untar.c +++ b/clamav-devel/libclamav/untar.c @@ -21,6 +21,9 @@ * * Change History: * $Log: untar.c,v $ + * Revision 1.15 2004/10/16 16:08:46 nigelhorne + * Handle empty files in the middle of archives + * * Revision 1.14 2004/10/13 10:18:54 nigelhorne * Added a few extra file types * @@ -64,7 +67,7 @@ * First draft * */ -static char const rcsid[] = "$Id: untar.c,v 1.14 2004/10/13 10:18:54 nigelhorne Exp $"; +static char const rcsid[] = "$Id: untar.c,v 1.15 2004/10/16 16:08:46 nigelhorne Exp $"; #include #include @@ -241,6 +244,7 @@ cli_untar(const char *dir, int desc) fclose(outfile); return CL_EFORMAT; } + cli_dbgmsg("cli_untar: size = %d\n", size); } else { /* write or continue writing file contents */ const int nbytes = size>512? 512:size; const int nwritten = fwrite(block, 1, nbytes, outfile); @@ -250,9 +254,9 @@ cli_untar(const char *dir, int desc) nwritten, fullname); } size -= nbytes; - if (size == 0) - in_block = 0; } + if (size == 0) + in_block = 0; } if(outfile) fclose(outfile);