[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-6156-g094ec9b

aCaB acab at clamav.net
Sun Apr 4 01:09:01 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit b8ce70e6a1f402f068a644837831c22bd71577c8
Author: aCaB <acab at clamav.net>
Date:   Fri Nov 6 15:25:47 2009 +0100

    bb#1695

diff --git a/ChangeLog b/ChangeLog
index 77470ec..72c80a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Fri Nov  6 16:14:09 CET 2009 (acab)
+-----------------------------------
+ * libclamav/tnef.c: don't use fgetc (bb#1695)
+
 Fri Nov  6 12:22:33 CET 2009 (tk)
 ---------------------------------
  * freshclam: add support for DetectionStatsHostID (bb#1503)
diff --git a/libclamav/tnef.c b/libclamav/tnef.c
index 8e405ed..19eb5f1 100644
--- a/libclamav/tnef.c
+++ b/libclamav/tnef.c
@@ -337,22 +337,13 @@ tnef_attachment(FILE *fp, uint16_t type, uint16_t tag, int32_t length, const cha
 				if(*fbref == NULL)
 					return -1;
 			}
-			for(todo = length; todo; todo--) {
-#if WORDS_BIGENDIAN == 1
-				int c;
-				unsigned char c2;
-
-				if((c = fgetc(fp)) == EOF)
-					break;
-				c2 = (unsigned char)c;
-				fileblobAddData(*fbref, (const unsigned char *)&c2, 1);
-#else
-				int c;
-
-				if((c = fgetc(fp)) == EOF)
-					break;
-				fileblobAddData(*fbref, (const unsigned char *)&c, 1);
-#endif
+			todo = length;
+			while(todo && !feof(fp) && !ferror(fp)) {
+			    unsigned char buf[BUFSIZ];
+			    uint32_t got = fread(buf, 1, MIN(sizeof(buf), todo), fp);
+
+			    fileblobAddData(*fbref, buf, got);
+			    todo -= got;
 			}
 			break;
 		default:

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list