(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/plugins/convert/convert-storage.c) |
| |
| 134 | | | static int mailbox_convert_maildir_to_dbox(struct mail_storage *src_storage, |
| 135 | | | struct mail_storage *dest_storage, |
| 136 | | | const char *src_name, |
| 137 | | | const char *dest_name) |
| 138 | | | { |
| 139 | | | static const char *maildir_files[] = { |
| 140 | | | "dovecot-uidlist", |
| 141 | | | "dovecot-keywords", |
| 142 | | | "dovecot.index", |
| 143 | | | "dovecot.index.log", |
| 144 | | | "dovecot.index.cache" |
| 145 | | | }; |
| 146 | | | string_t *src, *dest; |
| 147 | | | DIR *dir; |
| 148 | | | struct dirent *dp; |
| 149 | | | const char *src_path, *dest_path, *new_path, *cur_path; |
| 150 | | | unsigned int i, src_dir_len, dest_dir_len; |
| 151 | | | bool t; |
| 152 | | | int ret; |
| 153 | | | |
| 154 | | | |
| 155 | | | |
| 156 | [+] | | if (mail_storage_mailbox_create(dest_storage, dest_name, TRUE) < 0) { |
Event 1:
Skipping " if". !0 evaluates to true.
hide
|
|
 |
| 157 | | | i_error("Mailbox conversion: " |
| 158 | | | "Couldn't create mailbox %s: %s", |
| 159 | | | dest_name, storage_error(dest_storage)); |
| 160 | | | return -1; |
| 161 | | | } |
| 162 | | | |
| 163 | | | src_path = mail_storage_get_mailbox_path(src_storage, src_name, &t); |
| 164 | | | dest_path = mail_storage_get_mailbox_path(dest_storage, dest_name, &t); |
| 165 | | | |
| 166 | | | |
| 167 | | | cur_path = t_strconcat(src_path, "/cur", NULL); |
| 168 | | | |
| 169 | | | if (rename(cur_path, dest_path) < 0) { |
Event 4:
Skipping " if". rename(...) < 0 evaluates to false.
hide
|
|
| 170 | | | i_error("rename(%s, %s) failed: %m", cur_path, dest_path); |
| 171 | | | return -1; |
| 172 | | | } |
| 173 | | | |
| 174 | | | |
| 175 | | | src = t_str_new(256); |
| 176 | | | str_printfa(src, "%s/", src_path); |
| 177 | | | src_dir_len = str_len(src); |
| 178 | | | |
| 179 | [+] | | dest = t_str_new(256); |
 |
| 180 | | | str_printfa(dest, "%s/", dest_path); |
| 181 | | | dest_dir_len = str_len(dest); |
| 182 | | | |
| 183 | | | for (i = 0; i < N_ELEMENTS(maildir_files); 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 12:
Continuing from loop body. Entering loop body. i < sizeof( maildir_files ) / sizeof( maildir_files[0] ) evaluates to true.
hide
Event 23:
Continuing from loop body. Leaving loop. i < sizeof( maildir_files ) / sizeof( maildir_files[0] ) evaluates to false.
hide
|
|
| 184 | | | str_truncate(src, src_dir_len); |
| 185 | | | str_truncate(dest, dest_dir_len); |
| 186 | | | str_append(src, maildir_files[i]); |
| 187 | [+] | | str_append(dest, maildir_files[i]); |
 |
| 188 | | | |
| 189 | [+] | | if (rename(str_c(src), str_c(dest)) < 0 && errno != ENOENT) {
x /usr/include/asm-generic/errno-base.h |
| |
5 | #define ENOENT 2 /* No such file or directory */ |
| |
|
Event 13:
dest, which evaluates to the value assigned to buf at buffer.c:116, is passed to str_c(). See related event 10.
hide
|
|
 |
| 190 | | | i_error("rename(%s, %s) failed: %m", |
| 191 | | | str_c(src), str_c(dest)); |
| 192 | | | } |
| 193 | | | } |
| 194 | | | |
| 195 | | | |
| 196 | | | new_path = t_strconcat(src_path, "/new", NULL); |
| 197 | | | str_truncate(src, src_dir_len); |
| 198 | | | str_append(src, "new/"); |
| 199 | | | src_dir_len = str_len(src); |
| 200 | | | |
| 201 | | | dir = opendir(new_path); |
| 202 | | | if (dir == NULL) { |
Event 24:
Skipping " if". dir == (void *)0 evaluates to false.
hide
|
|
| 203 | | | if (errno == ENOENT)
x /usr/include/asm-generic/errno-base.h |
| |
5 | #define ENOENT 2 /* No such file or directory */ |
| |
|
| 204 | | | return 0; |
| 205 | | | |
| 206 | | | i_error("opendir(%s) failed: %m", new_path); |
| 207 | | | return -1; |
| 208 | | | } |
| 209 | | | ret = 0; |
| 210 | | | errno = 0; |
| 211 | | | while ((dp = readdir(dir)) != NULL) { |
Event 25:
readdir64 is an Undefined Function.
hide
Event 26:
Entering loop body. (dp = readdir(...)) != (void *)0 evaluates to true.
hide
|
|
| 212 | | | if (dp->d_name[0] == '.' && |
Event 27:
Skipping " if". dp->d_name[0] == 46 evaluates to false.
hide
|
|
| 213 | | | (dp->d_name[1] == '\0' || |
| 214 | | | (dp->d_name[1] == '.' && dp->d_name[2] == '\0'))) |
| 215 | | | continue; |
| 216 | | | |
| 217 | | | str_truncate(src, src_dir_len); |
| 218 | | | str_truncate(dest, dest_dir_len); |
| 219 | | | str_append(src, dp->d_name); |
| 220 | | | str_append(dest, dp->d_name); |
| 221 | | | |
| 222 | | | if (strstr(dp->d_name, ":2,") == NULL) |
Event 28:
Skipping " if". strstr(...) == (void *)0 evaluates to false.
hide
|
|
| 223 | | | str_append(dest, ":2,"); |
| 224 | | | |
| 225 | [+] | | if (rename(str_c(src), str_c(dest)) < 0) { |
Event 29:
dest, which evaluates to the value assigned to buf at buffer.c:116, is passed to str_c(). See related event 10.
hide
|
|
 |
| |