(/home/sate/Testcases/c/cve/wireshark-1.2.0/file.c) |
| |
| 3516 | | | cf_save(capture_file *cf, const char *fname, packet_range_t *range, guint save_format, gboolean compressed) |
| 3517 | | | { |
| 3518 | | | gchar *from_filename; |
| 3519 | | | int err; |
| 3520 | | | gboolean do_copy; |
| 3521 | | | wtap_dumper *pdh; |
| 3522 | | | save_callback_args_t callback_args; |
| 3523 | | | |
| 3524 | | | cf_callback_invoke(cf_cb_file_safe_started, (gpointer) fname); |
| 3525 | | | |
| 3526 | | | |
| 3527 | | | |
| 3528 | [+] | | if (file_exists(fname)) { |
 |
| 3529 | | | simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, |
| 3530 | | | "%sCapture file: \"%s\" already exists!%s\n\n" |
| 3531 | | | "Please choose a different filename.", |
| 3532 | | | simple_dialog_primary_start(), fname, simple_dialog_primary_end()); |
| 3533 | | | goto fail; |
| 3534 | | | } |
| 3535 | | | |
| 3536 | | | packet_range_process_init(range); |
| 3537 | | | |
| 3538 | | | |
| 3539 | | | if (packet_range_process_all(range) && save_format == cf->cd_t) { |
| 3540 | | | |
| 3541 | | | |
| 3542 | | | |
| 3543 | | | if (cf->is_tempfile) { |
Event 4:
Taking false branch. cf->is_tempfile evaluates to false.
hide
|
|
| 3544 | | | |
| 3545 | | | |
| 3546 | | | |
| 3547 | | | #ifndef _WIN32 |
| 3548 | | | if (ws_rename(cf->filename, fname) == 0) { |
| 3549 | | | |
| 3550 | | | from_filename = NULL; |
| 3551 | | | do_copy = FALSE; |
| 3552 | | | } else { |
| 3553 | | | if (errno == EXDEV) {
x /usr/include/asm-generic/errno-base.h |
| |
21 | #define EXDEV 18 /* Cross-device link */ |
| |
|
| 3554 3564 |  | | [ Lines 3554 to 3564 omitted. ] |
| 3565 | | | |
| 3566 | | | simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, |
| 3567 | | | file_rename_error_message(errno), fname); |
| 3568 | | | goto fail; |
| 3569 | | | } |
| 3570 | | | } |
| 3571 | | | #else |
| 3572 | | | do_copy = TRUE; |
| 3573 | | | from_filename = cf->filename; |
| 3574 | | | #endif |
| 3575 | | | } else { |
| 3576 | | | |
| 3577 | | | |
| 3578 | | | do_copy = TRUE; |
Event 5:
!0 evaluates to true.
hide
|
|
| 3579 | | | from_filename = cf->filename; |
| 3580 | | | } |
| 3581 | | | |
| 3582 | | | if (do_copy) { |
Event 6:
Taking true branch. do_copy evaluates to true.
hide
|
|
| 3583 | | | |
| 3584 | [+] | | if (!copy_file_binary_mode(from_filename, fname)) |
Event 7:
fname is passed to copy_file_binary_mode() as the second argument.
hide
|
|
 |
| 3585 | | | goto fail; |
| 3586 | | | } |
| 3587 | | | } else { |
| 3588 | | | |
| 3589 | | | |
| 3590 | | | |
| 3591 | | | pdh = wtap_dump_open(fname, save_format, cf->lnk_t, cf->snap, |
| 3592 | | | compressed, &err); |
| 3593 | | | if (pdh == NULL) { |
| 3594 | | | cf_open_failure_alert_box(fname, err, NULL, TRUE, save_format); |
| 3595 3626 |  | | [ Lines 3595 to 3626 omitted. ] |
| 3627 | | | wtap_dump_close(pdh, &err); |
| 3628 | | | goto fail; |
| 3629 | | | } |
| 3630 | | | |
| 3631 | | | if (!wtap_dump_close(pdh, &err)) { |
| 3632 | | | cf_close_failure_alert_box(fname, err); |
| 3633 | | | goto fail; |
| 3634 | | | } |
| 3635 | | | } |
| 3636 | | | |
| 3637 | | | cf_callback_invoke(cf_cb_file_safe_finished, NULL); |
| 3638 | | | |
| 3639 | [+] | | if (packet_range_process_all(range)) { |
 |
| 3640 | | | |
| 3641 | | | |
| 3642 | | | |
| 3643 | | | |
| 3644 | | | |
| 3645 | | | |
| 3646 | | | |
| 3647 | | | |
| 3648 | | | |
| 3649 | | | |
| 3650 | | | cf->user_saved = TRUE; |
Event 21:
!0 evaluates to true.
hide
|
|
| 3651 | | | |
| 3652 | [+] | | if ((cf_open(cf, fname, FALSE, &err)) == CF_OK) { |
Event 22:
fname is passed to cf_open() as the second argument.
hide
|
|
 |
| |