git-svn: trunk@4968
Tomasz Kojm authored on 2009/03/22 23:18:19... | ... |
@@ -1,3 +1,9 @@ |
1 |
+Sun Mar 22 15:15:22 CET 2009 (tk) |
|
2 |
+--------------------------------- |
|
3 |
+ * libclamav/readdb.c: return error instead of crashing when cl_load() gets |
|
4 |
+ called for already compiled engine (bb#1488); |
|
5 |
+ don't overwrite dboptions with new calls to cl_load() |
|
6 |
+ |
|
1 | 7 |
Sun Mar 22 15:01:24 CET 2009 (acab) |
2 | 8 |
----------------------------------- |
3 | 9 |
* libclamav: add cl_engine_get_num(CL_ENGINE_DB_OPTIONS) |
... | ... |
@@ -1649,6 +1649,11 @@ int cl_load(const char *path, struct cl_engine *engine, unsigned int *signo, uns |
1649 | 1649 |
return CL_ENULLARG; |
1650 | 1650 |
} |
1651 | 1651 |
|
1652 |
+ if(engine->dboptions & CL_DB_COMPILED) { |
|
1653 |
+ cli_errmsg("cl_load(): can't load new databases when engine is already compiled\n"); |
|
1654 |
+ return CL_EARG; |
|
1655 |
+ } |
|
1656 |
+ |
|
1652 | 1657 |
if(stat(path, &sb) == -1) { |
1653 | 1658 |
cli_errmsg("cl_load(): Can't get status of %s\n", path); |
1654 | 1659 |
return CL_ESTAT; |
... | ... |
@@ -1658,7 +1663,7 @@ int cl_load(const char *path, struct cl_engine *engine, unsigned int *signo, uns |
1658 | 1658 |
if((ret = phishing_init(engine))) |
1659 | 1659 |
return ret; |
1660 | 1660 |
|
1661 |
- engine->dboptions = dboptions; |
|
1661 |
+ engine->dboptions |= dboptions; |
|
1662 | 1662 |
|
1663 | 1663 |
switch(sb.st_mode & S_IFMT) { |
1664 | 1664 |
case S_IFREG: |