[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. 99ae9353f6834da0cb73f59f4b32d1f0ae1263fa

Stephen Gran steve at lobefin.net
Thu Sep 4 12:36:45 UTC 2008


The following commit has been merged in the debian/unstable branch:
commit 4a83b6b6c44adfa22f1b37cd24aa94b06e167581
Author: Stephen Gran <steve at lobefin.net>
Date:   Thu Sep 4 13:25:23 2008 +0100

    Revert "avoid using C99 flexible array members  (bb #1039)"
    
    This reverts commit 8c64a5e403c514062012ca6dccb14b64974519b1.

diff --git a/ChangeLog b/ChangeLog
index 6490987..bdfb6f7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,3 @@
-Mon Jun  2 17:59:15 EEST 2008 (edwin)
--------------------------------------
-  * libclamav/hashtab.[ch], scanners.c: avoid using C99 flexible array members
-  (bb #1039)
-
 Thu May 29 21:22:35 CEST 2008 (acab)
 ------------------------------------
   * libclamav/unzip.c: correct the previous fix
diff --git a/libclamav/hashtab.c b/libclamav/hashtab.c
index e2e8361..c198d9f 100644
--- a/libclamav/hashtab.c
+++ b/libclamav/hashtab.c
@@ -562,14 +562,9 @@ ssize_t hashset_toarray(const struct hashset* hs, uint32_t** array)
 struct uniq *uniq_init(uint32_t count) {
 	struct uniq *U;
 	if(!count) return NULL;
-	count = count <= 256 ? 256 : count + (count*20/100);
-	U = cli_malloc(sizeof(*U));
+ 	count = count <= 256 ? 256 : count + (count*20/100);
+	U = (struct uniqueid *)cli_calloc(1, sizeof(U)+sizeof(uint32_t)*count);
 	if(!U) return NULL;
-	U->uniques = cli_calloc(count, sizeof(uint32_t));
-	if(!U->uniques) {
-		free(U);
-		return NULL;
-	}
 	U->count = count;
 	return U;
 }
diff --git a/libclamav/hashtab.h b/libclamav/hashtab.h
index 5ac40fe..1829cde 100644
--- a/libclamav/hashtab.h
+++ b/libclamav/hashtab.h
@@ -109,11 +109,11 @@ ssize_t hashset_toarray(const struct hashset* hs, uint32_t** array);
 /* A basic storage for unique IDs */
 struct uniq {
 	uint32_t count;
-        uint32_t *uniques;
+        uint32_t uniques[];
 };
 
 struct uniq *uniq_init(uint32_t);
-#define uniq_free(X) do { if(X) free(X->uniques); free(X); } while (0)
+#define uniq_free(X) free(X);
 uint32_t uniq_add(struct uniq *, const char *, uint32_t, uint32_t *);
 uint32_t uniq_get(struct uniq *, const char *, uint32_t, uint32_t *);
 
diff --git a/libclamav/scanners.c b/libclamav/scanners.c
index 1f0f793..7fb491b 100644
--- a/libclamav/scanners.c
+++ b/libclamav/scanners.c
@@ -1113,7 +1113,7 @@ static int cli_scanole2(int desc, cli_ctx *ctx)
         ctx->recursion++;
 
 	ret = cli_vba_scandir(dir, ctx, vba);
-	uniq_free(vba);
+	free(vba);
 	if(ret != CL_VIRUS)
 	    if(cli_scandir(dir, ctx, 0) == CL_VIRUS)
 	        ret = CL_VIRUS;

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list