(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/plugins/acl/acl-mailbox-list.c) |
| |
| 226 | | | iter_mailbox_has_visible_children(struct acl_mailbox_list_iterate_context *ctx, |
| 227 | | | bool only_nonpatterns) |
| 228 | | | { |
| 229 | | | struct mailbox_list_iterate_context *iter; |
| 230 | | | const struct mailbox_info *info; |
| 231 | | | enum mailbox_list_iter_flags flags; |
| 232 | | | string_t *pattern; |
| 233 | | | const char *prefix; |
| 234 | | | unsigned int i, prefix_len; |
| 235 | | | bool stars = FALSE, ret = FALSE; |
| 236 | | | |
| 237 | | | |
| 238 | | | |
| 239 | | | if (ctx->lookup_boxes != NULL) { |
| 240 | | | |
| 241 | | | |
| 242 | | | |
| 243 | | | struct mailbox_node *node; |
| 244 | | | |
| 245 | | | node = mailbox_tree_lookup(ctx->lookup_boxes, ctx->info.name); |
| 246 | | | i_assert(node != NULL);
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 |
| |
|
| 247 | | | if (node->children == NULL) |
| 248 | | | return FALSE; |
| 249 | | | } |
| 250 | | | |
| 251 | | | |
| 252 | | | |
| 253 | | | |
| 254 | | | pattern = t_str_new(128); |
| 255 | | | for (i = 0; ctx->info.name[i] != '\0'; i++) { |
| 256 | | | if (ctx->info.name[i] != '*') |
| 257 | | | str_append_c(pattern, ctx->info.name[i]); |
| 258 | | | else { |
| 259 | | | stars = TRUE; |
| 260 | | | str_append_c(pattern, '%'); |
| 261 | | | } |
| 262 | | | } |
| 263 | | | str_append_c(pattern, ctx->sep); |
| 264 | | | str_append_c(pattern, '*'); |
| 265 | | | prefix = str_c(pattern); |
Ignored Return Value
The return value of str_c() is never checked in the highlighted execution scenario. - If the return value can indicate an error, the error will be ignored if the highlighted code executes.
- The return value of str_c() is checked 100% of the time in this project. CodeSonar is configured to enforce Ignored Return Value checks for any function whose return value is checked at least 96% of the time, unless the function is used fewer than 20 times. (To modify these thresholds, use configuration file parameters RETURN_CHECKER_SAMPLE_SIZE and RETURN_CHECKER_RATIO. To exempt str_c() from the Ignored Return Value check, use configuration file parameter RETURN_CHECKER_IGNORED_FUNCS).
Show: All events | Only primary events |
|
| 266 | | | prefix_len = str_len(pattern) - 1; |
| 267 | | | |
| 268 | | | flags = (ctx->ctx.flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) | |
| 269 | | | MAILBOX_LIST_ITER_RETURN_NO_FLAGS; |
| 270 | | | iter = mailbox_list_iter_init(ctx->ctx.list, str_c(pattern), flags); |
| 271 | | | while ((info = mailbox_list_iter_next(iter)) != NULL) { |
| 272 | | | if (only_nonpatterns && |
| 273 | | | imap_match(ctx->glob, info->name) == IMAP_MATCH_YES) { |
| 274 | | | |
| 275 | | | |
| 276 | | | ret = FALSE; |
| 277 | | | break; |
| 278 | | | } |
| 279 | | | if (!stars || strncmp(info->name, prefix, prefix_len) == 0) |
| 280 | | | ret = TRUE; |
| 281 | | | } |
| 282 | | | (void)mailbox_list_iter_deinit(&iter); |
| 283 | | | return ret; |
| 284 | | | } |
| |