... | ... |
@@ -109,6 +109,7 @@ const struct clam_option __clam_options[] = { |
109 | 109 |
{ NULL, "html-normalise", 0, TYPE_STRING, NULL, -1, NULL, 0, OPT_SIGTOOL, "", "" }, |
110 | 110 |
{ NULL, "utf16-decode", 0, TYPE_STRING, NULL, -1, NULL, 0, OPT_SIGTOOL, "", "" }, |
111 | 111 |
{ NULL, "build", 'b', TYPE_STRING, NULL, -1, NULL, 0, OPT_SIGTOOL, "", "" }, |
112 |
+ { NULL, "max-bad-sigs", 0, TYPE_NUMBER, MATCH_NUMBER, 3000, NULL, 0, OPT_SIGTOOL, "Maximum number of mismatched signatures when building a CVD. Zero disables this limit.", "3000" }, |
|
112 | 113 |
{ NULL, "unsigned", 0, TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_SIGTOOL, "", "" }, |
113 | 114 |
{ NULL, "no-cdiff", 0, TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_SIGTOOL, "", "" }, |
114 | 115 |
{ NULL, "server", 0, TYPE_STRING, NULL, -1, NULL, 0, OPT_SIGTOOL, "", "" }, |
... | ... |
@@ -639,7 +639,7 @@ static int build(const struct optstruct *opts) |
639 | 639 |
{ |
640 | 640 |
int ret, bc = 0; |
641 | 641 |
size_t bytes; |
642 |
- unsigned int i, sigs = 0, oldsigs = 0, entries = 0, version, real_header, fl; |
|
642 |
+ unsigned int i, sigs = 0, oldsigs = 0, entries = 0, version, real_header, fl, maxentries; |
|
643 | 643 |
STATBUF foo; |
644 | 644 |
unsigned char buffer[FILEBUFF]; |
645 | 645 |
char *tarfile, header[513], smbuff[32], builder[32], *pt, olddb[512]; |
... | ... |
@@ -752,11 +752,15 @@ static int build(const struct optstruct *opts) |
752 | 752 |
if(entries != sigs) |
753 | 753 |
mprintf("^build: Signatures in %s db files: %u, loaded by libclamav: %u\n", dbname, entries, sigs); |
754 | 754 |
|
755 |
- if(!entries || (sigs > entries && sigs - entries >= 1000)) { |
|
756 |
- mprintf("!Bad number of signatures in database files\n"); |
|
757 |
- FREE_LS(dblist2); |
|
758 |
- return -1; |
|
759 |
- } |
|
755 |
+ maxentries = optget(opts, "max-bad-sigs")->numarg; |
|
756 |
+ |
|
757 |
+ if (maxentries) { |
|
758 |
+ if(!entries || (sigs > entries && sigs - entries >= maxentries)) { |
|
759 |
+ mprintf("!Bad number of signatures in database files\n"); |
|
760 |
+ FREE_LS(dblist2); |
|
761 |
+ return -1; |
|
762 |
+ } |
|
763 |
+ } |
|
760 | 764 |
} |
761 | 765 |
|
762 | 766 |
/* try to read cvd header of current database */ |