Hi,

The latest scanners.c, rev1.175 in anonymous CVS includes a patch for if() parentheses for RAR-SFX and ZIP-SFX however 2 other entries in cli_magic_scandesc() were omitted. I noticed sf.net CVS has been down lately so it may be attributed to that.

However after applying the full if((ret = cli_scandesc(desc, ctx, 0, 0, NULL)) == CL_VIRUS) patch I started noticing a lot of "Unknown Error" entires in the logs which I think are caused by this code omitting ret assignement in cli_scanraw():
       case CL_TYPE_HTML:
       if(SCAN_HTML && type == CL_TYPE_UNKNOWN_TEXT)
           if(cli_scanhtml(desc, ctx) == CL_VIRUS)
           return CL_VIRUS;

ret is a filetype before a call to cli_scanhtml and type is returned instead of the cli_scanhtml code if there is no virus.

Patch with incorrect if() parentheses fix in cli_magic_scandesc() and ret assignment in cli_scanraw() attached.

Regards,
Alch



--- scanners.c  2006-04-02 10:51:12.567512000 +1000
+++ scanners.new        2006-04-02 11:06:04.059414400 +1000
@@ -1538,15 +1538,15 @@ static int cli_scanraw(int desc, cli_ctx
        ret == CL_TYPE_MAIL ? ctx->mrec++ : ctx->arec++;
        switch(ret) {
            case CL_TYPE_HTML:
-               if(SCAN_HTML && type == CL_TYPE_UNKNOWN_TEXT)
-                   if(cli_scanhtml(desc, ctx) == CL_VIRUS)
-                       return CL_VIRUS;
-               break;
-
-           case CL_TYPE_MAIL:
-               if(SCAN_MAIL && type == CL_TYPE_UNKNOWN_TEXT)
-                   if(cli_scanmail(desc, ctx) == CL_VIRUS)
-                       return CL_VIRUS;
+               if(SCAN_HTML && type == CL_TYPE_UNKNOWN_TEXT)
+                   if((ret = cli_scanhtml(desc, ctx)) == CL_VIRUS)
+                       return CL_VIRUS;
+               break;
+
+           case CL_TYPE_MAIL:
+               if(SCAN_MAIL && type == CL_TYPE_UNKNOWN_TEXT)
+                   if((ret = cli_scanmail(desc, ctx)) == CL_VIRUS)
+                       return CL_VIRUS;
                break;
 
            case CL_TYPE_RARSFX:
@@ -1614,7 +1614,7 @@ int cli_magic_scandesc(int desc, cli_ctx
 
     if(!ctx->options) { /* raw mode (stdin, etc.) */
        cli_dbgmsg("Raw mode: No support for special files\n");
-       if((ret = cli_scandesc(desc, ctx, 0, 0, NULL) == CL_VIRUS))
+       if((ret = cli_scandesc(desc, ctx, 0, 0, NULL)) == CL_VIRUS)
            cli_dbgmsg("%s found in descriptor %d\n", *ctx->virname, desc);
        return ret;
     }
@@ -1641,7 +1641,7 @@ int cli_magic_scandesc(int desc, cli_ctx
     lseek(desc, 0, SEEK_SET);
 
     if(type != CL_TYPE_DATA && ctx->engine->sdb) {
-       if((ret = cli_scanraw(desc, ctx, type) == CL_VIRUS))
+       if((ret = cli_scanraw(desc, ctx, type)) == CL_VIRUS)
            return CL_VIRUS;
        lseek(desc, 0, SEEK_SET);
     }
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html

Reply via email to