Merge lp:~larsu/unity/lp1495173 into lp:unity

Proposed by Lars Karlitski
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 4012
Proposed branch: lp:~larsu/unity/lp1495173
Merge into: lp:unity
Diff against target: 11 lines (+1/-1)
1 file modified
launcher/DevicesSettingsImp.cpp (+1/-1)
To merge this branch: bzr merge lp:~larsu/unity/lp1495173
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Andrea Azzarone (community) Approve
Review via email: mp+271446@code.launchpad.net

Commit message

DevicesSettingsImp: dont't feed garbage to gsettings

Use a const reference for the iteration variable in the loop over _blacklist so that the pointers returned from c_str() are still valid when feeding them to g_settings_set_strv().

In the best case, this only wrote garbage to the "blacklist" key (making that setting useless). In the worst case, it led to a crash because the garbage was invalid utf8, which gsettings refuses to accept.

Fixes LP: #1495173

Description of the change

DevicesSettingsImp: dont't feed garbage to gsettings

Use a const reference for the iteration variable in the loop over _blacklist so that the pointers returned from c_str() are still valid when feeding them to g_settings_set_strv().

In the best case, this only wrote garbage to the "blacklist" key (making that setting useless). In the worst case, it led to a crash because the garbage was invalid utf8, which gsettings refuses to accept.

Fixes LP: #1495173

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

LGTM.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launcher/DevicesSettingsImp.cpp'
2--- launcher/DevicesSettingsImp.cpp 2012-10-29 09:34:54 +0000
3+++ launcher/DevicesSettingsImp.cpp 2015-09-17 10:46:53 +0000
4@@ -77,7 +77,7 @@
5 const char* blacklist_to_be_uploaded[size+1];
6
7 int index = 0;
8- for (auto item : blacklist_)
9+ for (auto const &item : blacklist_)
10 blacklist_to_be_uploaded[index++] = item.c_str();
11 blacklist_to_be_uploaded[index] = nullptr;
12