From: Bartlomiej Grzelewski Date: Wed, 30 Nov 2016 18:17:30 +0000 (+0100) Subject: Prevent from memory corruption X-Git-Tag: accepted/tizen/3.0/common/20161206.125312~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8f3d169cb5b2d3d9ab68d9141058b61ece41460c;p=platform%2Fcore%2Fsecurity%2Faskuser.git Prevent from memory corruption Change-Id: Ieb8312031d606cc02ef2637cfece19f48cb0ba82 --- diff --git a/src/agent/notification-daemon/AskUserTalker.cpp b/src/agent/notification-daemon/AskUserTalker.cpp index 32e099b..6644eff 100644 --- a/src/agent/notification-daemon/AskUserTalker.cpp +++ b/src/agent/notification-daemon/AskUserTalker.cpp @@ -77,13 +77,12 @@ void setSecurityLevel(const std::string &app, const std::string &perm, const std } PolicyRequest updateRequest; - for (const auto &priv : privacyPrivs) { - PolicyEntry entry; - entry.setApp(appName); - entry.setPrivilege(priv); - entry.setLevel(level); - - updateRequest.addEntry(entry); + std::vector entryVector(privacyPrivs.size()); + for (size_t i=0; i < privacyPrivs.size(); ++i) { + entryVector[i].setApp(appName); + entryVector[i].setPrivilege(privacyPrivs[i]); + entryVector[i].setLevel(level); + updateRequest.addEntry(entryVector[i]); } updateRequest.updatePolicy(); ALOGD("SecurityManager: Setting level succeeded");