(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/maildir/maildir-storage.c) |
| |
| 920 | | | maildir_list_iter_is_mailbox(struct mailbox_list_iterate_context *ctx |
| 921 | | | ATTR_UNUSED, |
| 922 | | | const char *dir, const char *fname, |
| 923 | | | const char *mailbox_name ATTR_UNUSED, |
| 924 | | | enum mailbox_list_file_type type, |
| 925 | | | enum mailbox_info_flags *flags) |
| 926 | | | { |
| 927 | | | struct stat st, st2; |
| 928 | | | const char *path, *cur_path; |
| 929 | | | |
| 930 | [+] | | if (maildir_is_internal_name(fname)) { |
 |
| 931 | | | *flags |= MAILBOX_NONEXISTENT; |
| 932 | | | return 0; |
| 933 | | | } |
| 934 | | | |
| 935 | | | switch (type) { |
Event 5:
type evaluates to implicit-default.
hide
|
|
| 936 | | | case MAILBOX_LIST_FILE_TYPE_FILE: |
| 937 | | | case MAILBOX_LIST_FILE_TYPE_OTHER: |
| 938 | | | |
| 939 | | | *flags |= MAILBOX_NOSELECT; |
| 940 | | | return 0; |
| 941 | | | |
| 942 | | | case MAILBOX_LIST_FILE_TYPE_DIR: |
| 943 | | | case MAILBOX_LIST_FILE_TYPE_UNKNOWN: |
| 944 | | | case MAILBOX_LIST_FILE_TYPE_SYMLINK: |
| 945 | | | break; |
| 946 | | | } |
| 947 | | | |
| 948 | | | path = t_strdup_printf("%s/%s", dir, fname); |
| 949 | | | if (stat(path, &st) == 0) { |
Event 6:
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 7:
Taking false branch. stat(path, &st) == 0 evaluates to false.
hide
|
|
| 950 | | | 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. */ |
| |
|
| 951 | | | if (strncmp(fname, ".nfs", 4) == 0) { |
| 952 | | | |
| 953 | | | *flags |= MAILBOX_NONEXISTENT; |
| 954 | | | } else { |
| 955 | | | *flags |= MAILBOX_NOSELECT | |
| 956 | | | MAILBOX_NOINFERIORS; |
| 957 | | | } |
| 958 | | | return 0; |
| 959 | | | } |
| 960 | | | } else if (errno == ENOENT) {
x /usr/include/asm-generic/errno-base.h |
| |
5 | #define ENOENT 2 /* No such file or directory */ |
| |
|
Event 8:
Taking true branch. errno == 2 evaluates to true.
hide
|
|
| 961 | | | |
| 962 | | | *flags |= MAILBOX_NONEXISTENT; |
| 963 | | | } else { |
| 964 | | | |
| 965 | | | |
| 966 | | | *flags |= MAILBOX_NOSELECT; |
| 967 | | | } |
| 968 | | | if ((*flags & (MAILBOX_NOSELECT | MAILBOX_NONEXISTENT)) == 0) { |
Event 9:
Taking true branch. (*flags & (MAILBOX_NOSELECT | MAILBOX_NONEXISTENT)) == 0 evaluates to true.
hide
|
|
| 969 | | | |
| 970 | | | cur_path = t_strconcat(path, "/cur", NULL); |
| 971 | | | if (stat(cur_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 10:
Taking true branch. stat(cur_path, &st2) < 0 evaluates to true.
hide
|
|
| 972 | | | *flags |= MAILBOX_NOSELECT; |
| 973 | | | |
| 974 | | | if (*ctx->list->set.maildir_name == '\0') { |
Event 11:
Taking false branch. *ctx->list->set.maildir_name == 0 evaluates to false.
hide
|
|
| 975 | | | |
| 976 | | | |
| 977 | | | |
| 978 | | | |
| 979 | | | if ((*flags & MAILBOX_NOSELECT) == 0) { |
| 980 | | | if (st.st_nlink > 5) |
| 981 | | | *flags |= MAILBOX_CHILDREN; |
| 982 | | | else |
| 983 | | | *flags |= MAILBOX_NOCHILDREN; |
| 984 | | | } else { |
| 985 | | | if (st.st_nlink > 2) |
| 986 | | | *flags |= MAILBOX_CHILDREN; |
| 987 | | | else |
| 988 | | | *flags |= MAILBOX_NOCHILDREN; |
| 989 | | | } |
| 990 | | | } else { |
| 991 | | | |
| 992 | | | |
| 993 | | | if (st.st_nlink > 3) |
Uninitialized Variable
st was not initialized. The issue can occur if the highlighted code executes. See related event 6. Show: All events | Only primary events |
|
| |