[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:06:21 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit 50cff39641137c1c6f44776812b063ad8e6ecbaf
Author: aCaB <acab at clamav.net>
Date:   Thu Oct 1 14:25:41 2009 +0200

    fix some leaks

diff --git a/libclamav/disasm.c b/libclamav/disasm.c
index 628a480..870b032 100644
--- a/libclamav/disasm.c
+++ b/libclamav/disasm.c
@@ -1670,9 +1670,10 @@ static uint8_t *disasm_x86(uint8_t *command, unsigned int len, struct DISASMED *
 }
 
 
-void disasmbuf(uint8_t *buff, unsigned int len, int fd) {
+int disasmbuf(uint8_t *buff, unsigned int len, int fd) {
   uint8_t *next = buff;
   unsigned int counter=0;
+  int gotsome=0;
   struct DISASMED s;
   struct MARIO {
     uint16_t real_op;
@@ -1691,7 +1692,7 @@ void disasmbuf(uint8_t *buff, unsigned int len, int fd) {
     int i;
     if(!(next = disasm_x86(next, len, &s))) {
       /* TODO: invd opcode or buff over */
-      return;
+      return gotsome;
     }
     if(cli_debug_flag) {
       char hr[128];
@@ -1726,6 +1727,8 @@ void disasmbuf(uint8_t *buff, unsigned int len, int fd) {
       }
     }
     cli_writen(fd, &w, sizeof(w));
+    gotsome = 1;
   }
+  return gotsome;
 }
 
diff --git a/libclamav/disasm.h b/libclamav/disasm.h
index 1560661..5a4bc15 100644
--- a/libclamav/disasm.h
+++ b/libclamav/disasm.h
@@ -27,6 +27,6 @@
 
 #include "others.h"
 
-void disasmbuf(uint8_t *, unsigned int, int);
+int disasmbuf(uint8_t *, unsigned int, int);
 
 #endif
diff --git a/libclamav/nsis/nulsft.c b/libclamav/nsis/nulsft.c
index b55946e..ec749c8 100644
--- a/libclamav/nsis/nulsft.c
+++ b/libclamav/nsis/nulsft.c
@@ -537,6 +537,7 @@ int cli_scannulsft(int desc, cli_ctx *ctx, off_t offset) {
 	ret = CL_CLEAN;
 
     nsis_shutdown(&nsist);
+    fmunmap(nsist.map);
 
     if(!ctx->engine->keeptmp)
         cli_rmdirs(nsist.dir);
diff --git a/libclamav/pe.c b/libclamav/pe.c
index ee08a54..c6a6189 100644
--- a/libclamav/pe.c
+++ b/libclamav/pe.c
@@ -978,8 +978,8 @@ int cli_scanpe(cli_ctx *ctx)
     epsize = fmap_readn(map, epbuff, ep, 4096);
 
     CLI_UNPTEMP("DISASM",(exe_sections,0));
-    disasmbuf((unsigned char*)epbuff, epsize, ndesc);
-    ret = cli_scandesc(ndesc, ctx, CL_TYPE_PE_DISASM, 1, NULL, AC_SCAN_VIR);
+    if(disasmbuf((unsigned char*)epbuff, epsize, ndesc))
+	ret = cli_scandesc(ndesc, ctx, CL_TYPE_PE_DISASM, 1, NULL, AC_SCAN_VIR);
     close(ndesc);
     CLI_TMPUNLK();
     free(tempfile);
@@ -1428,11 +1428,6 @@ int cli_scanpe(cli_ctx *ctx)
 	    break;
 	}
 	
-	if((src = (char *) cli_malloc(ssize)) == NULL) {
-	    free(exe_sections);
-	    return CL_EMEM;
-	}
-
 	if(!exe_sections[i + 1].rsz || !(src = fmap_need_off_once(map, exe_sections[i + 1].raw, ssize))) {
 	    cli_dbgmsg("Can't read raw data of section %d\n", i + 1);
 	    free(exe_sections);
@@ -1672,12 +1667,6 @@ int cli_scanpe(cli_ctx *ctx)
 	    sections[t+1].rva = (((support[t*2]|(support[t*2+1]<<8))-2)<<12)-EC32(optional_hdr32.ImageBase);
 	}
 
-	if((src = (char *) cli_malloc(ssize)) == NULL) {
-	    free(exe_sections);
-	    free(sections);
-	    return CL_EMEM;
-	}
-
 	if(!exe_sections[i + 1].rsz || !(src = fmap_need_off_once(map, exe_sections[i + 1].raw, ssize))) {
 	    cli_dbgmsg("FSG: Can't read raw data of section %d\n", i);
 	    free(exe_sections);

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list