(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/plugins/expire/expire-tool.c) |
| |
| 222 | | | static void expire_run(bool testrun) |
| 223 | | | { |
| 224 | | | struct expire_context ctx; |
| 225 | | | struct dict *dict = NULL; |
| 226 | | | struct dict_transaction_context *trans; |
| 227 | | | struct dict_iterate_context *iter; |
| 228 | | | struct expire_env *env; |
| 229 | | | time_t oldest, expire_time; |
| 230 | | | unsigned int expunge_secs, altmove_secs; |
| 231 | | | const char *auth_socket, *p, *key, *value; |
| 232 | | | const char *userp, *mailbox, *expire, *expire_altmove, *base_dir; |
| 233 | | | int ret; |
| 234 | | | |
| 235 | | | expire = t_strdup(getenv("EXPIRE")); |
| 236 | [+] | | expire_altmove = t_strdup(getenv("EXPIRE_ALTMOVE")); |
 |
| 237 | | | if (expire == NULL && expire_altmove == NULL) |
Event 3:
Skipping " if". - expire == (void *)0 evaluates to true.
- expire_altmove == (void *)0 evaluates to false.
hide
|
|
| 238 | | | i_fatal("expire and expire_altmove settings not set"); |
| 239 | | | if (getenv("EXPIRE_DICT") == NULL) |
Event 4:
Skipping " if". getenv(...) == (void *)0 evaluates to false.
hide
|
|
| 240 | | | i_fatal("expire_dict setting not set"); |
| 241 | | | |
| 242 | | | |
| 243 | | | env_remove("EXPIRE"); |
| 244 | | | env_remove("EXPIRE_ALTMOVE"); |
| 245 | | | |
| 246 | | | if (getenv("MAIL_PLUGINS") == NULL) |
Event 5:
Taking false branch. getenv(...) == (void *)0 evaluates to false.
hide
|
|
| 247 | | | modules = NULL; |
| 248 | | | else { |
| 249 | | | const char *plugin_dir = getenv("MAIL_PLUGIN_DIR"); |
| 250 | | | const char *version; |
| 251 | | | |
| 252 | | | if (plugin_dir == NULL) |
Event 6:
Taking true branch. plugin_dir == (void *)0 evaluates to true.
hide
|
|
| 253 | | | plugin_dir = MODULEDIR"/lda"; |
| 254 | | | |
| 255 | | | version = getenv("VERSION_IGNORE") != NULL ? |
Event 7:
getenv(...) != (void *)0 evaluates to true.
hide
|
|
| 256 | | | NULL : PACKAGE_VERSION; |
| 257 | | | modules = module_dir_load(plugin_dir, getenv("MAIL_PLUGINS"), |
| 258 | | | TRUE, version); |
Event 8:
!0 evaluates to true.
hide
|
|
| 259 | | | } |
| 260 | | | |
| 261 | | | dict_drivers_register_builtin(); |
| 262 | | | mail_users_init(getenv("AUTH_SOCKET_PATH"), getenv("DEBUG") != NULL); |
Event 9:
getenv("DEBUG") != (void *)0 evaluates to false.
hide
|
|
| 263 | | | mail_storage_init(); |
| 264 | | | mail_storage_register_all(); |
| 265 | | | mailbox_list_register_all(); |
| 266 | | | |
| 267 | | | module_dir_init(modules); |
| 268 | | | |
| 269 | | | expire_get_global_mail_ids(); |
| 270 | | | |
| 271 | | | base_dir = getenv("BASE_DIR"); |
| 272 | | | if (base_dir == NULL) |
Event 10:
Skipping " if". base_dir == (void *)0 evaluates to false.
hide
|
|
| 273 | | | base_dir = PKG_RUNDIR; |
| 274 | | | auth_socket = getenv("AUTH_SOCKET_PATH"); |
| 275 | | | if (auth_socket == NULL) { |
Event 11:
Skipping " if". auth_socket == (void *)0 evaluates to false.
hide
|
|
| 276 | | | auth_socket = t_strconcat(base_dir, "/", |
| 277 | | | DEFAULT_AUTH_SOCKET_FNAME, NULL); |
| 278 | | | } |
| 279 | | | |
| 280 | | | memset(&ctx, 0, sizeof(ctx)); |
| 281 | | | ctx.testrun = testrun; |
| 282 | | | ctx.auth_conn = auth_master_init(auth_socket, getenv("DEBUG") != NULL); |
Event 12:
getenv("DEBUG") != (void *)0 evaluates to false.
hide
|
|
| 283 | | | env = expire_env_init(expire, expire_altmove); |
| 284 | | | dict = dict_init(getenv("EXPIRE_DICT"), DICT_DATA_TYPE_UINT32, "", |
Event 13:
getenv() returns NULL. - Dereferenced later, causing the null pointer dereference.
hide
Event 14:
getenv("EXPIRE_DICT"), which evaluates to NULL, is passed to dict_init() as the first argument. See related event 13.
hide
|
|
| 285 | [+] | | base_dir); |
 |
| |