tags 750075 + patch pending
thanks

On 2014-06-01 11:34:14 [+0100], Michael Tautschnig wrote:

fixed upstream by commit e0f667e7f1 ("bb11023 - Wrong declaration of
function destroy_ctx to cause undefined behavior").

> Best,
> Michael

Sebastian
>From e0f667e7f12ec561e6b87a3664f6f673c12908d3 Mon Sep 17 00:00:00 2001
From: Shawn Webb <[email protected]>
Date: Mon, 2 Jun 2014 08:54:43 -0400
Subject: [PATCH] bb11023 - Wrong declaration of function destroy_ctx to cause
 undefined behavior

---
 sigtool/sigtool.c | 4 ++--
 sigtool/vba.c     | 3 ++-
 sigtool/vba.h     | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/sigtool/sigtool.c b/sigtool/sigtool.c
index 04279bc..60bd850 100644
--- a/sigtool/sigtool.c
+++ b/sigtool/sigtool.c
@@ -1530,12 +1530,12 @@ static int vbadump(const struct optstruct *opts)
 	return -1;
     }
     if(cli_ole2_extract(dir, ctx, &vba)) {
-	destroy_ctx(ctx);
+	destroy_ctx(-1, ctx);
 	cli_rmdirs(dir);
         free(dir);
         return -1;
     }
-    destroy_ctx(ctx);
+    destroy_ctx(-1, ctx);
     if (vba) 
       sigtool_vba_scandir(dir, hex_output, vba);
     cli_rmdirs(dir);
diff --git a/sigtool/vba.c b/sigtool/vba.c
index 08b2806..09fe6d2 100644
--- a/sigtool/vba.c
+++ b/sigtool/vba.c
@@ -93,7 +93,8 @@ cli_ctx *convenience_ctx(int fd) {
 
 void destroy_ctx(int desc, cli_ctx *ctx) {
     funmap(*(ctx->fmap));
-    close(desc);
+    if (desc >= 0)
+        close(desc);
     free(ctx->fmap);
     cl_engine_free((struct cl_engine *)ctx->engine);
     free(ctx);
diff --git a/sigtool/vba.h b/sigtool/vba.h
index 96ce1de..b321357 100644
--- a/sigtool/vba.h
+++ b/sigtool/vba.h
@@ -25,6 +25,6 @@
 
 int sigtool_vba_scandir(const char *dirname, int hex_output, struct uniq *U);
 cli_ctx *convenience_ctx(int fd);
-void destroy_ctx(cli_ctx *ctx);
+void destroy_ctx(int desc, cli_ctx *ctx);
 
 #endif
-- 
2.0.0

_______________________________________________
Pkg-clamav-devel mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-clamav-devel

Reply via email to