(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/file-dotlock.c) |
| |
| 458 | | | dotlock_create(struct dotlock *dotlock, enum dotlock_create_flags flags, |
| 459 | | | bool write_pid, const char **lock_path_r) |
| 460 | | | { |
| 461 | | | const struct dotlock_settings *set = &dotlock->settings; |
| 462 | | | const char *lock_path; |
| 463 | | | struct lock_info lock_info; |
| 464 | | | struct stat st; |
| 465 | | | unsigned int stale_notify_threshold; |
| 466 | | | unsigned int change_secs, wait_left; |
| 467 | | | time_t now, max_wait_time, last_notify; |
| 468 | | | time_t prev_last_change = 0, prev_wait_update = 0; |
| 469 | | | string_t *tmp_path; |
| 470 | | | int ret; |
| 471 | | | bool do_wait; |
| 472 | | | |
| 473 | | | now = time(NULL); |
| 474 | | | |
| 475 | | | lock_path = *lock_path_r = |
Event 6:
*lock_path_r is set to t_strconcat(...), which evaluates to NULL. See related event 5.
hide
Event 7:
lock_path is set to *lock_path_r, which evaluates to NULL. See related event 6.
hide
|
|
| 476 | [+] | | t_strconcat(dotlock->path, set->lock_suffix, NULL); |
 |
| 477 | | | stale_notify_threshold = set->stale_timeout / 2; |
| 478 | | | max_wait_time = (flags & DOTLOCK_CREATE_FLAG_NONBLOCK) != 0 ? 0 : |
Event 8:
(flags & DOTLOCK_CREATE_FLAG_NONBLOCK) != 0 evaluates to false.
hide
|
|
| 479 | | | now + set->timeout; |
| 480 | | | tmp_path = t_str_new(256); |
| 481 | | | |
| 482 | | | memset(&lock_info, 0, sizeof(lock_info)); |
| 483 | | | lock_info.path = dotlock->path; |
| 484 | | | lock_info.set = set; |
| 485 | | | lock_info.lock_path = lock_path; |
Event 9:
lock_info.lock_path is set to lock_path, which evaluates to NULL. See related event 7.
hide
|
|
| 486 | | | lock_info.fd = -1; |
| 487 | | | lock_info.use_io_notify = set->use_io_notify; |
| 488 | | | |
| 489 | | | last_notify = 0; do_wait = FALSE; |
| 490 | | | |
| 491 | | | do { |
| 492 | | | if (do_wait) { |
Event 10:
Skipping " if". do_wait evaluates to false.
hide
|
|
| 493 | | | if (prev_last_change != lock_info.last_change) { |
| 494 | | | |
| 495 | | | |
| 496 | | | lock_info.wait_usecs = LOCK_RANDOM_USLEEP_TIME;
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/file-dotlock.c |
| |
25 | #define LOCK_RANDOM_USLEEP_TIME (100000 + (unsigned int)rand() % 100000) |
| |
|
| 497 | | | prev_last_change = lock_info.last_change; |
| 498 | | | prev_wait_update = now; |
| 499 | | | } else if (prev_wait_update != now && |
| 500 | | | lock_info.wait_usecs < LOCK_MAX_WAIT_USECS) { |
| 501 | | | |
| 502 | | | |
| 503 | | | prev_wait_update = now; |
| 504 | | | lock_info.wait_usecs += lock_info.wait_usecs/2; |
| 505 | | | } |
| 506 | | | dotlock_wait(&lock_info); |
| 507 | | | do_wait = FALSE; |
| 508 | | | } |
| 509 | | | |
| 510 | [+] | | ret = check_lock(now, &lock_info); |
Event 11:
&lock_info is passed to check_lock() as the second argument.
hide
|
|
 |
| |