Re: [Clamav-devel] more scanners.c issues (html and one typo)

2006-04-02 Thread Tomasz Kojm
On Sun, 02 Apr 2006 11:12:02 +1000
Alch [EMAIL PROTECTED] wrote:

 Hi,
 
 The latest scanners.c, rev1.175 in anonymous CVS includes a patch for 

The latest rev is 1.176.

 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.

H Starting with rev 1.174:

Wed Mar 29 15:45:03 CEST 2006 (tk)
--
  * libclamav/scanners.c: properly report archive unpacking errors
  Problem spotted by David F. Skoll
  dfs*roaringpenguin.com

the return value of the second cli_scanraw() call (the one called under
normal circumstances) is ignored so you should not experience the problem of
unknown errors.

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

The patch was incorrect (it could break recursion limit balance for mail
files, the current code in cli_scanraw() should be more clear about that,
though). But you're right cli_scanraw() should not return type values and
I will address that when cvs.sf.net is back.

-- 
   oo. Tomasz Kojm [EMAIL PROTECTED]
  (\/)\. http://www.ClamAV.net/gpg/tkojm.gpg
 \..._ 0DCA5A08407D5288279DB43454822DC8985A444B
   //\   /\  Sun Apr  2 12:31:44 CEST 2006


signature.asc
Description: PGP signature
___
http://lurker.clamav.net/list/clamav-devel.html


[Clamav-devel] more scanners.c issues (html and one typo)

2006-04-01 Thread Alch

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.new2006-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