Browse code

call cli_check_jpeg_exploit() independently of pattern matcher

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

Tomasz Kojm authored on 2005/03/19 09:02:47
Showing 4 changed files
... ...
@@ -1,3 +1,7 @@
1
+Sat Mar 19 00:58:19 CET 2005 (tk)
2
+---------------------------------
3
+  * libclamav: call cli_check_jpeg_exploit() independently of pattern matcher
4
+
1 5
 Fri Mar 18 22:03:10 CET 2005 (tk)
2 6
 ---------------------------------
3 7
   * libclamav: fix compiler warnings
... ...
@@ -218,22 +218,6 @@ int cli_validatesig(unsigned short target, unsigned short ftype, const char *off
218 218
 	}
219 219
     }
220 220
 
221
-    if(ftype == CL_TYPE_GRAPHICS && virname && !strncmp(virname, "Exploit.JPEG.Comment", 20)) {
222
-	    int old;
223
-
224
-	if((old = lseek(desc, 0, SEEK_CUR)) == -1) {
225
-	    cli_dbgmsg("Invalid descriptor\n");
226
-	    return 0;
227
-	}
228
-	lseek(desc, 0, SEEK_SET);
229
-	if(cli_check_jpeg_exploit(desc) != 1) {
230
-	    cli_dbgmsg("Eliminated false positive match of Exploit.JPEG.Comment\n");
231
-	    lseek(desc, old, SEEK_SET);
232
-	    return 0;
233
-	}
234
-	lseek(desc, old, SEEK_SET);
235
-    }
236
-
237 221
     return 1;
238 222
 }
239 223
 
... ...
@@ -534,6 +534,10 @@ static int cli_loadndb(FILE *fd, struct cl_node **root, unsigned int *signo)
534 534
 
535 535
     while(fgets(buffer, FILEBUFF, fd)) {
536 536
 	line++;
537
+
538
+	if(!strncmp(buffer, "Exploit.JPEG.Comment", 20)) /* temporary */
539
+	    continue;
540
+
537 541
 	sigs++;
538 542
 	cli_chomp(buffer);
539 543
 
... ...
@@ -1240,6 +1240,18 @@ static int cli_scanriff(int desc, const char **virname)
1240 1240
     return ret;
1241 1241
 }
1242 1242
 
1243
+static int cli_scanjpeg(int desc, const char **virname)
1244
+{
1245
+	int ret = CL_CLEAN;
1246
+
1247
+    if(cli_check_jpeg_exploit(desc) == 1) {
1248
+	ret = CL_VIRUS;
1249
+	*virname = "Exploit.W32.MS04-028";
1250
+    }
1251
+
1252
+    return ret;
1253
+}
1254
+
1243 1255
 static int cli_scanmail(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)
1244 1256
 {
1245 1257
 	char *dir;
... ...
@@ -1394,6 +1406,10 @@ int cli_magic_scandesc(int desc, const char **virname, long int *scanned, const
1394 1394
 	    ret = cli_scanriff(desc, virname);
1395 1395
 	    break;
1396 1396
 
1397
+	case CL_TYPE_GRAPHICS:
1398
+	    ret = cli_scanjpeg(desc, virname);
1399
+	    break;
1400
+
1397 1401
 	case CL_TYPE_DATA:
1398 1402
 	    /* it could be a false positive and a standard DOS .COM file */
1399 1403
 	    {