Wireshark-commits: [Wireshark-commits] master-1.12 aaaa98e: qt: fix use-after-free pattern
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=aaaa98ee26235fd481ce3e1afe958d0b48ef0901
Submitter: Alexis La Goutte (alexis.lagoutte@xxxxxxxxx)
Changed: branch: master-1.12
Repository: wireshark
Commits:
aaaa98e by Peter Wu (peter@xxxxxxxxxxxxx):
qt: fix use-after-free pattern
qstring.toUtf8() returns a QByteArray object and .constData() returns
a pointer inside that object. It is not safe to store this pointer as
it will become invalid after the statement. Store a const reference
instead. (Due to scoping differences, some are copy-assigned though.)
In the UAT dialog, strlen(bytes.constData()) has also been replaced by
bytes.size() as an optimization.
Caught by ASAN.
Reviewed-on: https://code.wireshark.org/review/5528
Petri-Dish: Gerald Combs <gerald@xxxxxxxxxxxxx>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@xxxxxxxxxxxxx>
Reviewed-by: Gerald Combs <gerald@xxxxxxxxxxxxx>
(cherry picked from commit 18f01099694ed5c2758105f893ba37589f552717)
Conflicts:
ui/qt/conversation_dialog.cpp
ui/qt/endpoint_dialog.cpp
ui/qt/traffic_table_dialog.cpp
[ files did not exist in 1.12 ]
Change-Id: Ib211d000a9b3f1bdd8ab4c8489a253af2df5fbd5
Reviewed-on: https://code.wireshark.org/review/5573
Reviewed-by: Balint Reczey <balint@xxxxxxxxxxxxxxx>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@xxxxxxxxx>
Actions performed:
from 1c14653 Lua accessor for Protocol field type gets wrong data
adds aaaa98e qt: fix use-after-free pattern
Summary of changes:
ui/qt/capture_filter_combo.cpp | 7 +++----
ui/qt/display_filter_combo.cpp | 7 +++----
ui/qt/export_pdu_dialog.cpp | 8 +++-----
ui/qt/uat_dialog.cpp | 17 +++++++++--------
4 files changed, 18 insertions(+), 21 deletions(-)