(/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 6:
Taking true branch. cf->is_tempfile evaluates to true.
hide
|
|
| 3544 | | | |
| 3545 | | | |
| 3546 | | | |
| 3547 | | | #ifndef _WIN32 |
| 3548 | | | if (ws_rename(cf->filename, fname) == 0) { |
Event 7:
cf->filename is passed to rename() as the first argument.
hide
Event 8:
rename() accesses the file named cf->filename. - The same name is used to access a file later, but it is not safe to assume that it will be the same underlying file.
See related event 7.
hide
Event 9:
Taking false branch. rename(...) == 0 evaluates to false.
hide
|
|
| 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 */ |
| |
|
Event 10:
Taking true branch. errno == 18 evaluates to true.
hide
|
|
| 3554 | | | |
| 3555 | | | |
| 3556 | | | do_copy = TRUE; |
Event 11:
!0 evaluates to true.
hide
|
|
| 3557 | | | from_filename = cf->filename; |
Event 12:
from_filename is set to cf->filename.
hide
|
|
| 3558 | | | } else { |
| 3559 | | | |
| 3560 | | | |
| 3561 | | | |
| 3562 | | | |
| 3563 | | | |
| 3564 | | | |
| 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; |
| 3579 | | | from_filename = cf->filename; |
| 3580 | | | } |
| 3581 | | | |
| 3582 | | | if (do_copy) { |
Event 13:
Taking true branch. do_copy evaluates to true.
hide
|
|
| 3583 | | | |
| 3584 | [+] | | if (!copy_file_binary_mode(from_filename, fname)) |
Event 14:
from_filename, which evaluates to cf->filename, is passed to copy_file_binary_mode() as the first argument. See related event 12.
hide
|
|
 |
| |