Browse code

Added a few extra file types

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

Nigel Horne authored on 2004/10/13 19:20:04
Showing 2 changed files
... ...
@@ -1,3 +1,9 @@
1
+Wed Oct 13 11:19:03 BST 2004 (njh)
2
+----------------------------------
3
+  * libclamav/untar.c:	Added handling of some extra file types within the
4
+				archive. Thanks to
5
+				djgardner@users.sourceforge.net
6
+
1 7
 Wed Oct 13 09:57:54 BST 2004 (trog)
2 8
 -----------------------------------
3 9
   * libclamav/special.c: fix logic check
... ...
@@ -17,9 +17,13 @@
17 17
  *
18 18
  * Much of this code is based on minitar.c which is in the public domain.
19 19
  * Author: Charles G. Waldman (cgw@pgt.com),  Aug 4 1998
20
+ * There are many tar files that this code cannot decode.
20 21
  *
21 22
  * Change History:
22 23
  * $Log: untar.c,v $
24
+ * Revision 1.14  2004/10/13 10:18:54  nigelhorne
25
+ * Added a few extra file types
26
+ *
23 27
  * Revision 1.13  2004/10/04 13:46:50  nigelhorne
24 28
  * Handle GNU tar files
25 29
  *
... ...
@@ -60,7 +64,7 @@
60 60
  * First draft
61 61
  *
62 62
  */
63
-static	char	const	rcsid[] = "$Id: untar.c,v 1.13 2004/10/04 13:46:50 nigelhorne Exp $";
63
+static	char	const	rcsid[] = "$Id: untar.c,v 1.14 2004/10/13 10:18:54 nigelhorne Exp $";
64 64
 
65 65
 #include <stdio.h>
66 66
 #include <errno.h>
... ...
@@ -159,12 +163,20 @@ cli_untar(const char *dir, int desc)
159 159
 
160 160
 			type = block[156];
161 161
 
162
+			/*
163
+			 * Extra types from djgardner@users.sourceforge.net
164
+			 */
162 165
 			switch(type) {
163
-				case '0':
164
-				case '\0':
166
+				case '0':	/* plain file */
167
+				case '\0':	/* plain file */
168
+				case '7':	/* contiguous file */
165 169
 					directory = 0;
166 170
 					break;
167
-				case '5':
171
+				case '5':	/* directory */
172
+				case '2':	/* sym link */
173
+				case '3':	/* char device */
174
+				case '4':	/* block device */
175
+				case '6':	/* fifo special */
168 176
 					directory = 1;
169 177
 					break;
170 178
 				default:
... ...
@@ -172,8 +184,10 @@ cli_untar(const char *dir, int desc)
172 172
 					return CL_EIO;
173 173
 			}
174 174
 
175
-			if(directory)
175
+			if(directory) {
176
+				in_block = 0;
176 177
 				continue;
178
+			}
177 179
 
178 180
 			strncpy(name, block, 100);
179 181
 			name[100] = '\0';