Browse code

handle empty files in SIS archives

git-svn: trunk@1834

Tomasz Kojm authored on 2006/01/31 05:12:22
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Mon Jan 30 21:10:57 CET 2006 (tk)
2
+---------------------------------
3
+  * libclamav/sis.c: handle empty files in SIS archives
4
+
1 5
 Fri Jan 27 16:01:31 CET 2006 (tk)
2 6
 ---------------------------------
3 7
   * freshclam: new option HTTPUserAgent to force different User-Agent header
... ...
@@ -253,6 +253,15 @@ static int sis_extract_simple(int fd, char *mfile, uint32_t length, uint32_t off
253 253
 	    filelen = cli_readint32(mfile + offset + 24 + 8 * (i + 1));
254 254
 	    osize = (uLongf) filelen;
255 255
 
256
+	    if(!osize) {
257
+		cli_dbgmsg("SIS: Empty file, skipping\n");
258
+		free(fname);
259
+		continue;
260
+	    }
261
+
262
+	    cli_dbgmsg("SIS: Compressed size: %d\n", csize);
263
+	    cli_dbgmsg("SIS: Original size: %d\n", osize);
264
+
256 265
 	    if(limits && limits->maxfilesize && osize > limits->maxfilesize) {
257 266
 		cli_dbgmsg("SIS: Size exceeded (%d, max: %ld)\n", osize, limits->maxfilesize);
258 267
 		if(BLOCKMAX) {