Browse code

Handle GNU tar files

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@970 77e5149b-7576-45b1-b177-96237e5ba77b

Nigel Horne authored on 2004/10/04 22:48:46
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Mon Oct  4 14:48:16 BST 2004 (njh)
2
+----------------------------------
3
+  * libclamav/untar.c:	Handle GNU tar files
4
+
1 5
 Mon Oct  4 13:38:23 BST 2004 (njh)
2 6
 ----------------------------------
3 7
   * clamav-milter:	Fix mails containing viruses being kept twice in
... ...
@@ -20,6 +20,9 @@
20 20
  *
21 21
  * Change History:
22 22
  * $Log: untar.c,v $
23
+ * Revision 1.13  2004/10/04 13:46:50  nigelhorne
24
+ * Handle GNU tar files
25
+ *
23 26
  * Revision 1.12  2004/10/04 10:53:15  nigelhorne
24 27
  * Handle tar files less than 512 bytes
25 28
  *
... ...
@@ -57,7 +60,7 @@
57 57
  * First draft
58 58
  *
59 59
  */
60
-static	char	const	rcsid[] = "$Id: untar.c,v 1.12 2004/10/04 10:53:15 nigelhorne Exp $";
60
+static	char	const	rcsid[] = "$Id: untar.c,v 1.13 2004/10/04 13:46:50 nigelhorne Exp $";
61 61
 
62 62
 #include <stdio.h>
63 63
 #include <errno.h>
... ...
@@ -147,10 +150,10 @@ cli_untar(const char *dir, int desc)
147 147
 				break;
148 148
 
149 149
 			/* Notice assumption that BLOCKSIZE > 262 */
150
-			strncpy(magic, block+257, 6);
151
-			magic[6] = '\0';
152
-			if(strcmp(magic, "ustar ") != 0) {
153
-				cli_dbgmsg("Incorrect magic number in tar header\n");
150
+			strncpy(magic, block+257, 5);
151
+			magic[5] = '\0';
152
+			if(strcmp(magic, "ustar") != 0) {
153
+				cli_dbgmsg("Incorrect magic string '%s' in tar header\n", magic);
154 154
 				return CL_EFORMAT;
155 155
 			}
156 156