Browse code

don't return type values in cli_scanraw()

git-svn: trunk@1886

Tomasz Kojm authored on 2006/04/05 08:17:32
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Wed Apr  5 01:13:22 CEST 2006 (tk)
2
+----------------------------------
3
+  * libclamav/scanners.c: don't return type values in cli_scanraw()
4
+			  Spotted by Alch <alch*users.sourceforge.net>
5
+
1 6
 Wed Apr  5 00:52:12 CEST 2006 (tk)
2 7
 ----------------------------------
3 8
   * libclamav/pe.c: fix possible integer overflow reported by Damian Put
... ...
@@ -1505,7 +1505,7 @@ static int cli_scanmail(int desc, cli_ctx *ctx)
1505 1505
 
1506 1506
 static int cli_scanraw(int desc, cli_ctx *ctx, cli_file_t type)
1507 1507
 {
1508
-	int ret = CL_CLEAN;
1508
+	int ret = CL_CLEAN, nret = CL_CLEAN;
1509 1509
 	unsigned short ftrec;
1510 1510
 	struct cli_matched_type *ftoffset = NULL, *fpt;
1511 1511
 	uint32_t lastzip, lastrar;
... ...
@@ -1539,13 +1539,13 @@ static int cli_scanraw(int desc, cli_ctx *ctx, cli_file_t type)
1539 1539
 	switch(ret) {
1540 1540
 	    case CL_TYPE_HTML:
1541 1541
 		if(SCAN_HTML && type == CL_TYPE_UNKNOWN_TEXT)
1542
-		    if(cli_scanhtml(desc, ctx) == CL_VIRUS)
1542
+		    if((nret = cli_scanhtml(desc, ctx)) == CL_VIRUS)
1543 1543
 			return CL_VIRUS;
1544 1544
 		break;
1545 1545
 
1546 1546
 	    case CL_TYPE_MAIL:
1547 1547
 		if(SCAN_MAIL && type == CL_TYPE_UNKNOWN_TEXT)
1548
-		    if(cli_scanmail(desc, ctx) == CL_VIRUS)
1548
+		    if((nret = cli_scanmail(desc, ctx)) == CL_VIRUS)
1549 1549
 			return CL_VIRUS;
1550 1550
 		break;
1551 1551
 
... ...
@@ -1558,11 +1558,11 @@ static int cli_scanraw(int desc, cli_ctx *ctx, cli_file_t type)
1558 1558
 			while(fpt) {
1559 1559
 			    if(fpt->type == CL_TYPE_RARSFX) {
1560 1560
 				cli_dbgmsg("RAR-SFX signature found at %d\n", fpt->offset);
1561
-				if((ret = cli_scanrar(desc, ctx, fpt->offset, &lastrar)) == CL_VIRUS)
1561
+				if((nret = cli_scanrar(desc, ctx, fpt->offset, &lastrar)) == CL_VIRUS)
1562 1562
 				    break;
1563 1563
 			    } else if(fpt->type == CL_TYPE_ZIPSFX) {
1564 1564
 				cli_dbgmsg("ZIP-SFX signature found at %d\n", fpt->offset);
1565
-				if((ret = cli_scanzip(desc, ctx, fpt->offset, &lastzip)) == CL_VIRUS)
1565
+				if((nret = cli_scanzip(desc, ctx, fpt->offset, &lastzip)) == CL_VIRUS)
1566 1566
 				    break;
1567 1567
 			    }
1568 1568
 			    fpt = fpt->next;
... ...
@@ -1575,8 +1575,8 @@ static int cli_scanraw(int desc, cli_ctx *ctx, cli_file_t type)
1575 1575
 			free(fpt);
1576 1576
 		    }
1577 1577
 
1578
-		    if(ret == CL_VIRUS)
1579
-			return ret;
1578
+		    if(nret == CL_VIRUS)
1579
+			return nret;
1580 1580
 		}
1581 1581
 		break;
1582 1582
 
... ...
@@ -1584,6 +1584,7 @@ static int cli_scanraw(int desc, cli_ctx *ctx, cli_file_t type)
1584 1584
 		break;
1585 1585
 	}
1586 1586
 	ret == CL_TYPE_MAIL ? ctx->mrec-- : ctx->arec--;
1587
+	ret = nret;
1587 1588
     }
1588 1589
 
1589 1590
     return ret;