(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/imap/cmd-append.c) |
| |
| 382 | | | static bool cmd_append_continue_message(struct client_command_context *cmd) |
| 383 | | | { |
| 384 | | | struct client *client = cmd->client; |
| 385 | | | struct cmd_append_context *ctx = cmd->context; |
| 386 | | | size_t size; |
| 387 | | | int ret; |
| 388 | | | |
| 389 | | | if (cmd->cancel) { |
| 390 | | | cmd_append_finish(ctx); |
| 391 | | | return TRUE; |
| 392 | | | } |
| 393 | | | |
| 394 | | | if (ctx->save_ctx != NULL) { |
| 395 | | | while (ctx->input->v_offset != ctx->msg_size) { |
| 396 | | | ret = i_stream_read(ctx->input); |
Ignored Return Value
The return value of i_stream_read() 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 i_stream_read() is checked 98% 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 i_stream_read() from the Ignored Return Value check, use configuration file parameter RETURN_CHECKER_IGNORED_FUNCS).
Show: All events | Only primary events |
|
| 397 | | | if (mailbox_save_continue(ctx->save_ctx) < 0) { |
Event 2:
Taking true branch. mailbox_save_continue(...) < 0 evaluates to true.
hide
|
|
| 398 | | | |
| 399 | | | |
| 400 | | | mailbox_save_cancel(&ctx->save_ctx); |
| 401 | | | break; |
| 402 | | | } |
| 403 | | | if (ret == -1 || ret == 0) |
| 404 | | | break; |
| 405 | | | } |
| 406 | | | } |
| 407 | | | |
| 408 | | | if (ctx->save_ctx == NULL) { |
Event 3:
Taking true branch. ctx->save_ctx == (void *)0 evaluates to true.
hide
|
|
| 409 | | | (void)i_stream_read(ctx->input); |
| 410 | | | (void)i_stream_get_data(ctx->input, &size); |
| 411 | | | i_stream_skip(ctx->input, size); |
| 412 | | | } |
| 413 | | | |
| 414 | | | if (ctx->input->eof || client->input->closed) { |
| 415 | | | bool all_written = ctx->input->v_offset == ctx->msg_size; |
Event 5:
ctx->input->v_offset == ctx->msg_size evaluates to false.
hide
|
|
| 416 | | | |
| 417 | | | |
| 418 | | | i_stream_unref(&ctx->input); |
| 419 | | | ctx->input = NULL; |
| 420 | | | |
| 421 | | | if (ctx->save_ctx == NULL) { |
Event 6:
Taking true branch. ctx->save_ctx == (void *)0 evaluates to true.
hide
|
|
| 422 | | | |
| 423 | | | client_send_storage_error(cmd, ctx->storage); |
| 424 | | | ctx->failed = TRUE; |
Event 7:
!0 evaluates to true.
hide
|
|
| 425 | | | } else if (!all_written) { |
| 426 | | | |
| 427 | | | |
| 428 | | | ctx->failed = TRUE; |
| 429 | | | mailbox_save_cancel(&ctx->save_ctx); |
| 430 | | | client_disconnect(client, "EOF while appending"); |
| 431 | | | } else if (mailbox_save_finish(&ctx->save_ctx) < 0) { |
| 432 | | | ctx->failed = TRUE; |
| 433 | | | client_send_storage_error(cmd, ctx->storage); |
| 434 | | | } |
| 435 | | | ctx->save_ctx = NULL; |
| 436 | | | |
| 437 | | | if (client->input->closed) { |
Event 8:
Skipping " if". client->input->closed evaluates to false.
hide
|
|
| 438 | | | cmd_append_finish(ctx); |
| 439 | | | return TRUE; |
| 440 | | | } |
| 441 | | | |
| 442 | | | |
| 443 | | | ctx->message_input = FALSE; |
| 444 | | | imap_parser_reset(ctx->save_parser); |
| 445 | | | cmd->func = cmd_append_continue_parsing; |
| 446 | | | return cmd_append_continue_parsing(cmd); |
| 447 | | | } |
| 448 | | | |
| 449 | | | return FALSE; |
| 450 | | | } |
| |