(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/dbox/dbox-storage.c) |
| |
| 610 | | | static int dbox_list_iter_is_mailbox(struct mailbox_list_iterate_context *ctx |
| 611 | | | ATTR_UNUSED, |
| 612 | | | const char *dir, const char *fname, |
| 613 | | | const char *mailbox_name ATTR_UNUSED, |
| 614 | | | enum mailbox_list_file_type type, |
| 615 | | | enum mailbox_info_flags *flags) |
| 616 | | | { |
| 617 | | | const char *path, *maildir_path; |
| 618 | | | struct stat st, st2; |
| 619 | | | int ret = 1; |
| 620 | | | |
| 621 | | | |
| 622 | | | if (type != MAILBOX_LIST_FILE_TYPE_DIR && |
Event 1:
Skipping " if". type != MAILBOX_LIST_FILE_TYPE_DIR evaluates to false.
hide
|
|
| 623 | | | type != MAILBOX_LIST_FILE_TYPE_SYMLINK && |
| 624 | | | type != MAILBOX_LIST_FILE_TYPE_UNKNOWN) { |
| 625 | | | |
| 626 | | | *flags |= MAILBOX_NOSELECT | MAILBOX_NOINFERIORS; |
| 627 | | | return 0; |
| 628 | | | } |
| 629 | | | |
| 630 | | | |
| 631 | | | path = t_strconcat(dir, "/", fname, NULL); |
| 632 | | | if (stat(path, &st) == 0) { |
Event 2:
stat64() does not initialize st. - This may be because of a failure case or other special case for stat64(). Consult the stat64() documentation for more information.
hide
Event 3:
Taking false branch. stat(path, &st) == 0 evaluates to false.
hide
|
|
| 633 | | | if (!S_ISDIR(st.st_mode)) {
x /usr/include/sys/stat.h |
| |
131 | #define S_ISDIR(mode) __S_ISTYPE((mode), __S_IFDIR) |
| |
x /usr/include/sys/stat.h |
| |
129 | #define __S_ISTYPE(mode, mask) (((mode) & __S_IFMT) == (mask)) |
| |
x /usr/include/bits/stat.h |
| |
182 | #define __S_IFMT 0170000 /* These bits determine file type. */ |
| |
x /usr/include/bits/stat.h |
| |
185 | #define __S_IFDIR 0040000 /* Directory. */ |
| |
|
| 634 | | | |
| 635 | | | *flags |= MAILBOX_NOSELECT | MAILBOX_NOINFERIORS; |
| 636 | | | ret = 0; |
| 637 | | | } else if (st.st_nlink == 2) { |
| 638 | | | |
| 639 | | | *flags |= MAILBOX_NOCHILDREN; |
| 640 | | | } else if (*ctx->list->set.maildir_name != '\0') { |
| 641 | | | |
| 642 | | | |
| 643 | | | |
| 644 | | | |
| 645 | | | if (st.st_nlink > 3) |
| 646 | | | *flags |= MAILBOX_CHILDREN; |
| 647 | | | } else { |
| 648 | | | |
| 649 | | | |
| 650 | | | if (st.st_nlink > 2) |
| 651 | | | *flags |= MAILBOX_CHILDREN; |
| 652 | | | } |
| 653 | | | } else if (errno == ENOENT) {
x /usr/include/asm-generic/errno-base.h |
| |
5 | #define ENOENT 2 /* No such file or directory */ |
| |
|
Event 4:
Taking false branch. errno == 2 evaluates to false.
hide
|
|
| 654 | | | |
| 655 | | | *flags |= MAILBOX_NONEXISTENT; |
| 656 | | | } else { |
| 657 | | | |
| 658 | | | |
| 659 | | | *flags |= MAILBOX_NOSELECT; |
| 660 | | | } |
| 661 | | | if ((*flags & (MAILBOX_NOSELECT | MAILBOX_NONEXISTENT)) == 0) { |
Event 5:
Taking true branch. (*flags & (MAILBOX_NOSELECT | MAILBOX_NONEXISTENT)) == 0 evaluates to true.
hide
|
|
| 662 | | | |
| 663 | | | maildir_path = t_strconcat(path, "/"DBOX_MAILDIR_NAME, NULL); |
| 664 | | | if (stat(maildir_path, &st2) < 0 || !S_ISDIR(st2.st_mode))
x /usr/include/sys/stat.h |
| |
131 | #define S_ISDIR(mode) __S_ISTYPE((mode), __S_IFDIR) |
| |
x /usr/include/sys/stat.h |
| |
129 | #define __S_ISTYPE(mode, mask) (((mode) & __S_IFMT) == (mask)) |
| |
x /usr/include/bits/stat.h |
| |
182 | #define __S_IFMT 0170000 /* These bits determine file type. */ |
| |
x /usr/include/bits/stat.h |
| |
185 | #define __S_IFDIR 0040000 /* Directory. */ |
| |
|
Event 6:
Taking true branch. stat(maildir_path, &st2) < 0 evaluates to true.
hide
|
|
| 665 | | | *flags |= MAILBOX_NOSELECT; |
| 666 | | | if (st.st_nlink == 3 && *ctx->list->set.maildir_name != '\0') { |
Uninitialized Variable
st was not initialized. The issue can occur if the highlighted code executes. See related event 2. Show: All events | Only primary events |
|
| |