libclamav: report error instead of crashing when engine is not compiled (bb#1416)

git-svn: trunk@4882
0.95
Tomasz Kojm 16 years ago
parent d2ddc54fa7
commit b3df93db89
  1. 5
      ChangeLog
  2. 3
      libclamav/clamav.h
  3. 1
      libclamav/readdb.c
  4. 5
      libclamav/scanners.c

@ -1,3 +1,8 @@
Mon Mar 2 17:37:50 CET 2009 (tk)
---------------------------------
* libclamav: report error instead of crashing when engine is not compiled
(bb#1416)
Mon Mar 2 17:09:33 CET 2009 (tk)
---------------------------------
* shared/optparser.c: fix handling of options which are enabled by default

@ -72,10 +72,11 @@ typedef enum {
#define CL_DB_PHISHING_URLS 0x8
#define CL_DB_PUA 0x10
#define CL_DB_CVDNOTMP 0x20
#define CL_DB_OFFICIAL 0x40
#define CL_DB_OFFICIAL 0x40 /* internal */
#define CL_DB_PUA_MODE 0x80
#define CL_DB_PUA_INCLUDE 0x100
#define CL_DB_PUA_EXCLUDE 0x200
#define CL_DB_COMPILED 0x400 /* internal */
/* recommended db settings */
#define CL_DB_STDOPT (CL_DB_PHISHING | CL_DB_PHISHING_URLS)

@ -2044,6 +2044,7 @@ int cl_engine_compile(struct cl_engine *engine)
cli_dconf_print(engine->dconf);
mpool_flush(engine->mempool);
engine->dboptions |= CL_DB_COMPILED;
return CL_SUCCESS;
}

@ -1862,6 +1862,11 @@ int cli_magic_scandesc(int desc, cli_ctx *ctx)
if(!ctx->engine) {
cli_errmsg("CRITICAL: engine == NULL\n");
return CL_ENULLARG;
}
if(!(ctx->engine->dboptions & CL_DB_COMPILED)) {
cli_errmsg("CRITICAL: engine not compiled\n");
return CL_EMALFDB;
}

Loading…
Cancel
Save