Browse code

enable RAR SFX unpacking

git-svn: trunk@1640

Trog authored on 2005/06/29 18:46:55
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Wed Jun 29 10:45:33 BST 2005 (trog)
2
+-----------------------------------
3
+  * libclamav: enable RAR SFX unpacking
4
+
1 5
 Wed Jun 29 03:05:45 CEST 2005 (tk)
2 6
 ----------------------------------
3 7
   * libclamav: fix rar-sfx detection
... ...
@@ -115,7 +115,7 @@ static void cli_unlock_mutex(void *mtx)
115 115
 #endif
116 116
 */
117 117
 
118
-static int cli_scanrar(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, unsigned int arec, unsigned int mrec)
118
+static int cli_scanrar(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, unsigned int arec, unsigned int mrec, unsigned long int offset)
119 119
 {
120 120
 	int fd, ret = CL_CLEAN;
121 121
 	unsigned int files = 0;
... ...
@@ -134,6 +134,7 @@ static int cli_scanrar(int desc, const char **virname, long int *scanned, const
134 134
 	return CL_ETMPDIR;
135 135
     }
136 136
 
137
+    lseek(desc, offset, SEEK_SET);
137 138
     metadata = metadata_tmp = cli_unrar(desc, dir, limits);
138 139
 
139 140
     if(cli_scandir(dir, virname, scanned, root, limits, options, arec, mrec) == CL_VIRUS) {
... ...
@@ -1437,7 +1438,7 @@ int cli_magic_scandesc(int desc, const char **virname, long int *scanned, const
1437 1437
     switch(type) {
1438 1438
 	case CL_TYPE_RAR:
1439 1439
 	    if(SCAN_ARCHIVE)
1440
-		ret = cli_scanrar(desc, virname, scanned, root, limits, options, arec, mrec);
1440
+		ret = cli_scanrar(desc, virname, scanned, root, limits, options, arec, mrec, 0);
1441 1441
 	    break;
1442 1442
 
1443 1443
 	case CL_TYPE_ZIP:
... ...
@@ -1580,6 +1581,8 @@ int cli_magic_scandesc(int desc, const char **virname, long int *scanned, const
1580 1580
 		case CL_TYPE_RARSFX:
1581 1581
 		    if(SCAN_ARCHIVE && type == CL_TYPE_MSEXE)
1582 1582
 			cli_dbgmsg("RAR-SFX found at %d\n", ftoffset);
1583
+			if(cli_scanrar(desc, virname, scanned, root, limits, options, arec, mrec, ftoffset) == CL_VIRUS)
1584
+			    return CL_VIRUS;
1583 1585
 		    break;
1584 1586
 	    }
1585 1587
 	    nret == CL_TYPE_MAIL ? mrec-- : arec--;