Browse code

don't report I/O error when EP is near (less than 200 bytes) to the end of file

git-svn: trunk@2487

Tomasz Kojm authored on 2006/11/05 23:13:25
Showing 2 changed files
... ...
@@ -1,3 +1,9 @@
1
+Sun Nov  5 15:08:09 CET 2006 (tk)
2
+---------------------------------
3
+  * libclamav/pe.c: don't report I/O error when EP is near (less than 200 bytes)
4
+		    to the end of file (fixes handling of RCryptor encrypted
5
+		    files and some infected execs)
6
+
1 7
 Sun Nov  5 09:57:44 GMT 2006 (njh)
2 8
 ----------------------------------
3 9
   * clamav-milter:	Another go at bug 115
... ...
@@ -1,7 +1,6 @@
1 1
 /*
2 2
  *  Copyright (C) 2004 - 2006 Tomasz Kojm <tkojm@clamav.net>
3
- *
4
- *  With additions from aCaB <acab@clamav.net>
3
+ *			      aCaB <acab@clamav.net>
5 4
  *
6 5
  *  This program is free software; you can redistribute it and/or modify
7 6
  *  it under the terms of the GNU General Public License as published by
... ...
@@ -1820,8 +1819,9 @@ int cli_scanpe(int desc, cli_ctx *ctx)
1820 1820
     found = 2;
1821 1821
 
1822 1822
     lseek(desc, ep, SEEK_SET);
1823
-    if(cli_readn(desc, buff, 200) != 200) {
1824
-	cli_dbgmsg("Can't read 200 bytes\n");
1823
+    memset(buff, 0, sizeof(buff));
1824
+    if(cli_readn(desc, buff, 200) == -1) {
1825
+	cli_dbgmsg("cli_readn() failed\n");
1825 1826
 	free(section_hdr);
1826 1827
 	return CL_EIO;
1827 1828
     }