cvd.c checks that we read the entire file, which we don't for
skipped bytecodes.
And we don't read the trailing source code from cbcs.
This all worked for small cbcs since reading the header was enough to
get the entire cbc into the dbio buffer.
... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Tue May 11 15:31:40 EEST 2010 (edwin) |
|
2 |
+------------------------------------- |
|
3 |
+ * libclamav/readdb.c: read the entire .cbc files, fix loading of bytecode.cvd |
|
4 |
+ |
|
1 | 5 |
Tue May 11 11:36:21 EEST 2010 (edwin) |
2 | 6 |
------------------------------------- |
3 | 7 |
* libclamav/pdf.c: New PDF parser with better javascript support (bb #1596). |
... | ... |
@@ -1378,6 +1378,7 @@ static int cli_loadldb(FILE *fs, struct cl_engine *engine, unsigned int *signo, |
1378 | 1378 |
|
1379 | 1379 |
static int cli_loadcbc(FILE *fs, struct cl_engine *engine, unsigned int *signo, unsigned int options, struct cli_dbio *dbio, const char *dbname) |
1380 | 1380 |
{ |
1381 |
+ char buf[4096]; |
|
1381 | 1382 |
int rc; |
1382 | 1383 |
struct cli_all_bc *bcs = &engine->bcs; |
1383 | 1384 |
struct cli_bc *bc; |
... | ... |
@@ -1419,6 +1420,10 @@ static int cli_loadcbc(FILE *fs, struct cl_engine *engine, unsigned int *signo, |
1419 | 1419 |
} |
1420 | 1420 |
|
1421 | 1421 |
rc = cli_bytecode_load(bc, fs, dbio, security_trust); |
1422 |
+ /* read remainder of DB, needed because cvd.c checks that we read the entire |
|
1423 |
+ * file */ |
|
1424 |
+ while (cli_dbgets(buf, sizeof(buf), fs, dbio)) {} |
|
1425 |
+ |
|
1422 | 1426 |
if (rc != CL_SUCCESS) { |
1423 | 1427 |
cli_errmsg("Unable to load %s bytecode: %s\n", dbname, cl_strerror(rc)); |
1424 | 1428 |
return rc; |