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

tkojm tkojm at 77e5149b-7576-45b1-b177-96237e5ba77b
Fri Jun 12 19:12:14 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 9668f777182167f50aa1752f4e9d2954669f5777
Author: tkojm <tkojm at 77e5149b-7576-45b1-b177-96237e5ba77b>
Date:   Fri May 22 12:10:02 2009 +0000

    libclamav/readdb.c: add offset checks (bb#1615)
    
    
    git-svn-id: http://svn.clamav.net/svn/clamav-devel/trunk@5070 77e5149b-7576-45b1-b177-96237e5ba77b

diff --git a/ChangeLog b/ChangeLog
index 6cfc9c4..cdc3272 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Fri May 22 14:09:23 CEST 2009 (tk)
+----------------------------------
+ * libclamav/readdb.c: add offset checks (bb#1615)
+
 Thu May 21 15:41:36 CEST 2009 (tk)
 ----------------------------------
  * clamscan, clamdscan: add support for --file-list/-f
diff --git a/libclamav/readdb.c b/libclamav/readdb.c
index 398f1bf..4602511 100644
--- a/libclamav/readdb.c
+++ b/libclamav/readdb.c
@@ -517,6 +517,27 @@ static int cli_loadpdb(FILE *fs, struct cl_engine *engine, unsigned int *signo,
     return CL_SUCCESS;
 }
 
+static int cli_checkoffset(const char *offset, unsigned int type)
+{
+	unsigned int foo;
+	const char *pt = offset;
+
+    if(isdigit(*offset)) {
+	while(*pt++)
+	    if(!strchr("0123456789,", *pt))
+		return 1;
+	return 0;
+    }
+
+    if(!strncmp(offset, "EOF-", 4))
+	return 0;
+
+    if((type == 1 || type == 6) && (!strncmp(offset, "EP+", 3) || !strncmp(offset, "EP-", 3) || (sscanf(offset, "SL+%u", &foo) == 1) || (sscanf(offset, "S%u+%u", &foo, &foo) == 2)))
+	return 0;
+
+    return 1;
+}
+
 #define NDB_TOKENS 6
 static int cli_loadndb(FILE *fs, struct cl_engine *engine, unsigned int *signo, unsigned short sdb, unsigned int options, struct cli_dbio *dbio, const char *dbname)
 {
@@ -602,6 +623,12 @@ static int cli_loadndb(FILE *fs, struct cl_engine *engine, unsigned int *signo,
 	if(!strcmp(offset, "*"))
 	    offset = NULL;
 
+	if(offset && cli_checkoffset(offset, target)) {
+	    cli_errmsg("Incorrect offset '%s' for signature type-%u\n", offset, target);
+	    ret = CL_EMALFDB;
+	    break;
+	}
+
 	sig = tokens[3];
 
 	if((ret = cli_parse_add(root, virname, sig, 0, 0, offset, target, NULL, options))) {
@@ -937,6 +964,12 @@ static int cli_loadldb(FILE *fs, struct cl_engine *engine, unsigned int *signo,
 		sig = tokens[3 + i];
 	    }
 
+	    if(offset && cli_checkoffset(offset, tdb.target[0])) {
+		cli_errmsg("Incorrect offset '%s' in subsignature id %u for signature type-%u\n", offset, i, tdb.target[0]);
+		ret = CL_EMALFDB;
+		break;
+	    }
+
 	    if((ret = cli_parse_add(root, virname, sig, 0, 0, offset, target, lsigid, options))) {
 		ret = CL_EMALFDB;
 		break;

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list