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

Török Edvin edwin at clamav.net
Sun Apr 4 01:15:23 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit f6798708fd7c4c7c7b464f45fd25cbcf01962192
Author: Török Edvin <edwin at clamav.net>
Date:   Fri Jan 15 18:17:55 2010 +0200

    Fix some pointer dereferences, and sizeof.
    
    There were some variables initialized with values from dereferenced pointers,
    and the null check after the init.
    Also sizeof must be applied to pointed to element.

diff --git a/libclamav/bytecode.c b/libclamav/bytecode.c
index 6466a99..75ea60f 100644
--- a/libclamav/bytecode.c
+++ b/libclamav/bytecode.c
@@ -110,7 +110,7 @@ static int cli_bytecode_context_reset(struct cli_bc_ctx *ctx)
 int cli_bytecode_context_clear(struct cli_bc_ctx *ctx)
 {
     cli_bytecode_context_reset(ctx);
-    memset(ctx, 0, sizeof(ctx));
+    memset(ctx, 0, sizeof(*ctx));
     return CL_SUCCESS;
 }
 
diff --git a/libclamav/cache.c b/libclamav/cache.c
index e9b97d6..8c395cb 100644
--- a/libclamav/cache.c
+++ b/libclamav/cache.c
@@ -722,13 +722,16 @@ void cache_add(unsigned char *md5, size_t size, cli_ctx *ctx) {
 /* Hashes a file onto the provided buffer and looks it up the cache.
    Returns CL_VIRUS if found, CL_CLEAN if not FIXME or an error */
 int cache_check(unsigned char *hash, cli_ctx *ctx) {
-    fmap_t *map = *ctx->fmap;
-    size_t todo = map->len, at = 0;
+    fmap_t *map;
+    size_t todo, at = 0;
     cli_md5_ctx md5;
 
     if(!ctx || !ctx->engine || !ctx->engine->cache)
        return CL_VIRUS;
 
+    map = *ctx->fmap;
+    todo = map->len;
+
     cli_md5_init(&md5);
     while(todo) {
 	void *buf;
diff --git a/libclamav/pe_icons.c b/libclamav/pe_icons.c
index a0ac330..a35733a 100644
--- a/libclamav/pe_icons.c
+++ b/libclamav/pe_icons.c
@@ -1173,12 +1173,14 @@ static int parseicon(icon_groupset *set, uint32_t rva, cli_ctx *ctx, struct cli_
     unsigned int scanlinesz, andlinesz;
     unsigned int width, height, depth, x, y;
     unsigned int err, scalemode = 2, enginesize;
-    fmap_t *map = *ctx->fmap;
-    uint32_t icoff = cli_rawaddr(rva, exe_sections, nsections, &err, map->len, hdr_size);
+    fmap_t *map;
+    uint32_t icoff;
     struct icon_matcher *matcher;
 
     if(!ctx || !ctx->engine || !(matcher=ctx->engine->iconcheck))
 	return CL_SUCCESS;
+    map = *ctx->fmap;
+    icoff = cli_rawaddr(rva, exe_sections, nsections, &err, map->len, hdr_size);
 
     /* read the bitmap header */
     if(err || !(imagedata = fmap_need_off_once(map, icoff, 4))) {

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list