[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:17:51 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit 4e1ff79beacafbbe559f8b7f2b1ee85152b3e4f8
Author: Török Edvin <edwin at clamav.net>
Date:   Fri Jan 29 12:31:11 2010 +0200

    Test field offset rather than size.
    
    Just because fields are packed, doesn't mean the struct doesn't have padding.

diff --git a/libclamav/others.c b/libclamav/others.c
index 59b3a02..d896dc2 100644
--- a/libclamav/others.c
+++ b/libclamav/others.c
@@ -259,10 +259,13 @@ int cl_init(unsigned int initoptions)
 	struct timeval tv;
 	unsigned int pid = (unsigned int) getpid();
 
-    if (sizeof(unrar_main_header_t) != UNRAR_MAIN_HEADER_TAG_LEN) {
-	cli_errmsg("Structure packing not working, expected %u bytes, got %u bytes\n",
-		   sizeof(unrar_main_header_t), UNRAR_MAIN_HEADER_TAG_LEN);
-	return CL_EARG;
+    {
+	unrar_main_header_t x;
+	if (((char*)&x.flags - (char*)&x) != 3) {
+	    cli_errmsg("Structure packing not working, got %u offset, expected %u\n",
+		       (char*)&x.flags - (char*)&x, 3);
+	    return CL_EARG;
+	}
     }
     /* put dlopen() stuff here, etc. */
     if (lt_init() == 0) {

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list