(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/unlink-old-files.c) |
| |
| 16 | | | unlink_old_files_real(const char *dir, const char *prefix, time_t min_time) |
| 17 | | | { |
| 18 | | | DIR *dirp; |
| 19 | | | struct dirent *d; |
| 20 | | | struct stat st; |
| 21 | | | string_t *path; |
| 22 | | | unsigned int prefix_len, dir_len; |
| 23 | | | |
| 24 | | | dirp = opendir(dir); |
| 25 | | | if (dirp == NULL) { |
Event 1:
Skipping " if". dirp == (void *)0 evaluates to false.
hide
|
|
| 26 | | | if (errno != ENOENT)
x /usr/include/asm-generic/errno-base.h |
| |
5 | #define ENOENT 2 /* No such file or directory */ |
| |
|
| 27 | | | i_error("opendir(%s) failed: %m", dir); |
| 28 | | | return -1; |
| 29 | | | } |
| 30 | | | |
| 31 | [+] | | path = t_str_new(256); |
 |
| 32 | | | str_printfa(path, "%s/", dir); |
| 33 | | | dir_len = str_len(path); |
| 34 | | | |
| 35 | | | prefix_len = strlen(prefix); |
| 36 | | | while ((d = readdir(dirp)) != NULL) { |
Event 8:
readdir64 is an Undefined Function.
hide
Event 9:
Entering loop body. (d = readdir(...)) != (void *)0 evaluates to true.
hide
|
|
| 37 | | | if (d->d_name[0] == '.' && |
Event 10:
Skipping " if". d->d_name[0] == 46 evaluates to false.
hide
|
|
| 38 | | | (d->d_name[1] == '\0' || |
| 39 | | | (d->d_name[1] == '.' && d->d_name[2] == '\0'))) { |
| 40 | | | |
| 41 | | | continue; |
| 42 | | | } |
| 43 | | | if (strncmp(d->d_name, prefix, prefix_len) != 0) |
Event 11:
Skipping " if". strncmp(...) != 0 evaluates to false.
hide
|
|
| 44 | | | continue; |
| 45 | | | |
| 46 | | | str_truncate(path, dir_len); |
| 47 | [+] | | str_append(path, d->d_name); |
 |
| 48 | [+] | | if (stat(str_c(path), &st) < 0) { |
Event 12:
path, which evaluates to the value assigned to buf at buffer.c:116, is passed to str_c(). See related event 7.
hide
|
|
 |
| 49 | | | if (errno != ENOENT)
x /usr/include/asm-generic/errno-base.h |
| |
5 | #define ENOENT 2 /* No such file or directory */ |
| |
|
| 50 | | | i_error("stat(%s) failed: %m", str_c(path)); |
| 51 | | | } else if (!S_ISDIR(st.st_mode) && st.st_ctime < min_time) {
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. */ |
| |
x /usr/include/bits/stat.h |
| |
96 | # define st_ctime st_ctim.tv_sec |
| |
|
| 52 | [+] | | if (unlink(str_c(path)) < 0 && errno != ENOENT)
x /usr/include/asm-generic/errno-base.h |
| |
5 | #define ENOENT 2 /* No such file or directory */ |
| |
|
Event 23:
path, which evaluates to the value assigned to buf at buffer.c:116, is passed to str_c(). See related event 7.
hide
|
|
 |
| |