(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/maildir/maildir-util.c) |
| |
| 173 | | | static int maildir_create_subdirs(struct maildir_mailbox *mbox) |
| 174 | | | { |
| 175 | | | static const char *subdirs[] = { "cur", "new", "tmp" }; |
| 176 | | | const char *dirs[N_ELEMENTS(subdirs) + 2];
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/macros.h |
| |
18 | #define N_ELEMENTS(arr) \ |
19 | (sizeof(arr) / sizeof((arr)[0])) |
| |
|
| 177 | | | struct mailbox *box = &mbox->ibox.box; |
| 178 | | | struct stat st; |
| 179 | | | const char *path; |
| 180 | | | unsigned int i; |
| 181 | | | bool is_mail_dir; |
| 182 | | | |
| 183 | | | |
| 184 | | | for (i = 0; i < N_ELEMENTS(subdirs); i++)
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/macros.h |
| |
18 | #define N_ELEMENTS(arr) \ |
19 | (sizeof(arr) / sizeof((arr)[0])) |
| |
|
Event 1:
The loop is executed one or more times.
hide
|
|
| 185 | | | dirs[i] = t_strconcat(mbox->path, "/", subdirs[i], NULL); |
| 186 | | | dirs[i++] = mail_storage_get_mailbox_control_dir(box->storage, |
| 187 | | | box->name); |
| 188 | | | dirs[i++] = mail_storage_get_mailbox_index_dir(box->storage, |
| 189 | | | box->name); |
| 190 | | | i_assert(i == N_ELEMENTS(dirs));
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/macros.h |
| |
189 | #define i_assert(expr) STMT_START{ \ |
190 | if (unlikely(!(expr))) \ |
191 | i_panic("file %s: line %d (%s): assertion failed: (%s)", \ |
192 | __FILE__, \ |
193 | __LINE__, \ |
194 | __PRETTY_FUNCTION__, \ |
195 | #expr); }STMT_END |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/macros.h |
| |
18 | #define N_ELEMENTS(arr) \ |
19 | (sizeof(arr) / sizeof((arr)[0])) |
| |
|
Event 2:
Skipping " if". i == sizeof( dirs ) / sizeof( dirs[0] ) evaluates to true.
hide
Event 3:
Skipping " if". !(i == sizeof( dirs ) / sizeof( dirs[0] )) evaluates to false.
hide
Event 4:
Skipping " if". !!(i == sizeof( dirs ) / sizeof( dirs[0] )) evaluates to true.
hide
Event 5:
Skipping " if". !!!(i == sizeof( dirs ) / sizeof( dirs[0] )) evaluates to false.
hide
Event 6:
Skipping " if". __builtin_expect(...) evaluates to false.
hide
|
|
| 191 | | | |
| 192 | | | for (i = 0; i < N_ELEMENTS(dirs); i++) {
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/macros.h |
| |
18 | #define N_ELEMENTS(arr) \ |
19 | (sizeof(arr) / sizeof((arr)[0])) |
| |
|
Event 7:
i is set to 0.
hide
Event 8:
Entering loop body. i < sizeof( dirs ) / sizeof( dirs[0] ) evaluates to true.
hide
|
|
| 193 | | | path = dirs[i]; |
Event 9:
path is set to dirs[0]. See related event 7.
hide
|
|
| 194 | | | if (path == NULL || stat(path, &st) == 0) |
Event 10:
Skipping " if". - path == (void *)0 evaluates to false.
- stat(path, &st) == 0 evaluates to false.
hide
Event 11:
path, which evaluates to dirs[0], is passed to stat64() as the first argument. See related event 9.
hide
Event 12:
stat64() accesses the file named path, where path is dirs[0]. - The same name is used to access a file later, but it is not safe to assume that it will be the same underlying file.
See related event 11.
hide
|
|
| 195 | | | continue; |
| 196 | | | if (errno != ENOENT) {
x /usr/include/asm-generic/errno-base.h |
| |
5 | #define ENOENT 2 /* No such file or directory */ |
| |
|
Event 13:
Skipping " if". errno != 2 evaluates to false.
hide
|
|
| 197 | | | mail_storage_set_critical(box->storage, |
| 198 | | | "stat(%s) failed: %m", path); |
| 199 | | | break; |
| 200 | | | } |
| 201 | | | is_mail_dir = i < N_ELEMENTS(subdirs);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/macros.h |
| |
18 | #define N_ELEMENTS(arr) \ |
19 | (sizeof(arr) / sizeof((arr)[0])) |
| |
|
Event 14:
i < sizeof( subdirs ) / sizeof( subdirs[0] ) evaluates to true.
hide
|
|
| 202 | [+] | | if (maildir_create_path(box, path, is_mail_dir) < 0) |
Event 15:
path, which evaluates to dirs[0], is passed to maildir_create_path() as the second argument. See related event 9.
hide
|
|
 |
| |