aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/models
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2019-07-30 12:31:38 +0200
committerRoland Knall <rknall@gmail.com>2019-07-30 11:34:35 +0000
commit927afac57082d8703ffd39e293f2511adcac7644 (patch)
treed6ef589516e862358c25512483789803bfb3068c /ui/qt/models
parent5d0a2ccbb7119c667b078e8346e8e900f169e7df (diff)
Qt: Check for NULL pointer in profile->reference
Check for NULL pointer before using profile->reference in strcmp() because this will give a crash. Doing a copy profile from a new profile will set the reference to NULL in get_profile_parent(). Use an unambiguously profile reference value NULL as profile->reference when creating a new profile to align with when copy from a new profile. Change-Id: Ib27a1a309776e9c2ec44677f2d22f9a5635dd38a Reviewed-on: https://code.wireshark.org/review/34137 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'ui/qt/models')
-rw-r--r--ui/qt/models/profile_model.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/ui/qt/models/profile_model.cpp b/ui/qt/models/profile_model.cpp
index 63a6e4c54d..4e7b280016 100644
--- a/ui/qt/models/profile_model.cpp
+++ b/ui/qt/models/profile_model.cpp
@@ -502,7 +502,7 @@ QModelIndex ProfileModel::addNewProfile(QString name)
cnt++;
}
- add_to_profile_list(newName.toUtf8().constData(), "", PROF_STAT_NEW, FALSE, FALSE);
+ add_to_profile_list(newName.toUtf8().constData(), Q_NULLPTR, PROF_STAT_NEW, FALSE, FALSE);
loadProfiles();
return index(findByName(newName), COL_NAME);
@@ -629,7 +629,7 @@ bool ProfileModel::setData(const QModelIndex &idx, const QVariant &value, int ro
g_free(prof->name);
prof->name = qstring_strdup(value.toString());
- if (strcmp(prof->name, prof->reference) == 0) {
+ if (prof->reference && strcmp(prof->name, prof->reference) == 0) {
prof->status = PROF_STAT_EXISTS;
} else if (prof->status == PROF_STAT_EXISTS) {
prof->status = PROF_STAT_CHANGED;