diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2015-09-05 19:39:51 +0200 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2015-09-08 06:30:02 +0000 |
commit | 91d863cc1612453d4ed1c7629738d3057ea61373 (patch) | |
tree | df83452cbec2148c970f814a935ca46ec288b4fd /ui/qt/export_dissection_dialog.cpp | |
parent | f25b8c6784e7dab61e0754159dd3202bda584da9 (diff) |
Qt: Fix use-after-free pattern
This fixes crashes due to use of deallocated memory in:
- Export Packet Dissections
- Merge Capture Files
- Edit Packet Comment
Change-Id: I3dab8c0735eb5e642d6a4580d20bc3c81cf1345b
Reviewed-on: https://code.wireshark.org/review/10392
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'ui/qt/export_dissection_dialog.cpp')
-rw-r--r-- | ui/qt/export_dissection_dialog.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ui/qt/export_dissection_dialog.cpp b/ui/qt/export_dissection_dialog.cpp index 80360fbec3..14a7acb4e4 100644 --- a/ui/qt/export_dissection_dialog.cpp +++ b/ui/qt/export_dissection_dialog.cpp @@ -48,9 +48,9 @@ ExportDissectionDialog::ExportDissectionDialog(QWidget *parent, capture_file *ca QFileDialog(parent), export_type_(export_type), cap_file_(cap_file) - #if !defined(Q_OS_WIN) +#if !defined(Q_OS_WIN) , save_bt_(NULL) - #endif /* Q_OS_WIN */ +#endif /* Q_OS_WIN */ { #if !defined(Q_OS_WIN) QDialogButtonBox *button_box = findChild<QDialogButtonBox *>(); @@ -86,6 +86,7 @@ ExportDissectionDialog::ExportDissectionDialog(QWidget *parent, capture_file *ca fd_grid->addItem(new QSpacerItem(1, 1), last_row, 0); fd_grid->addLayout(h_box, last_row, 1); + print_args_.file = NULL; /* Init the export range */ packet_range_init(&print_args_.range, cap_file_); /* Default to displayed packets */ @@ -120,6 +121,9 @@ ExportDissectionDialog::ExportDissectionDialog(QWidget *parent, capture_file *ca ExportDissectionDialog::~ExportDissectionDialog() { +#if !defined(Q_OS_WIN) + g_free(print_args_.file); +#endif } int ExportDissectionDialog::exec() @@ -137,7 +141,7 @@ int ExportDissectionDialog::exec() /* Fill in our print (and export) args */ - print_args_.file = file_name.toUtf8().data(); + print_args_.file = qstring_strdup(file_name); print_args_.format = PR_FMT_TEXT; print_args_.to_file = TRUE; print_args_.cmd = NULL; |