Browse code

fix signature offset calculation in large files

git-svn: trunk@1527

Tomasz Kojm authored on 2005/05/10 11:48:56
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Tue May 10 04:47:28 CEST 2005 (tk)
2
+----------------------------------
3
+  * libclamav/matcher.c: fix signature offset calculation in large files
4
+			 (problem reported by Christoph)
5
+
1 6
 Mon May  9 18:06:53 BST 2005 (njh)
2 7
 ----------------------------------
3 8
   * clamav-milter:	Print segfault diagnostic, even if print_trace is
... ...
@@ -311,11 +311,15 @@ int cli_scandesc(int desc, const char **virname, long int *scanned, const struct
311 311
 
312 312
 	if(bytes == SCANBUFF) {
313 313
 	    memmove(buffer, endbl, root->maxpatlen);
314
-	    offset += bytes - root->maxpatlen;
315
-	}
316 314
 
317
-        pt = buffer;
318
-        length = buffsize;
315
+	    if(pt == buffer) {
316
+		offset += SCANBUFF;
317
+	    } else {
318
+		offset += SCANBUFF - root->maxpatlen;
319
+		pt = buffer;
320
+		length = buffsize;
321
+	    }
322
+	}
319 323
 
320 324
 	if(root->md5_hlist)
321 325
 	    MD5_Update(&ctx, buff, bytes);