Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1531)

Unified Diff: chrome/browser/policy/policy_path_parser_mac.mm

Issue 6966032: Sanitize enclosing quotes around paths in policies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed one forgotten copyright header. Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/policy/policy_path_parser_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/policy_path_parser_mac.mm
diff --git a/chrome/browser/policy/policy_path_parser_mac.mm b/chrome/browser/policy/policy_path_parser_mac.mm
index 48d0653c574ee8765c5b7d29b0508b9590cfe185..7f1d3dab2bec5cd5d5f753b43e78b71913c151af 100644
--- a/chrome/browser/policy/policy_path_parser_mac.mm
+++ b/chrome/browser/policy/policy_path_parser_mac.mm
@@ -38,6 +38,15 @@ const MacFolderNamesToSPDMaping mac_folder_mapping[] = {
FilePath::StringType ExpandPathVariables(
const FilePath::StringType& untranslated_string) {
FilePath::StringType result(untranslated_string);
+ if (result.length() == 0)
+ return result;
+ // Sanitize quotes in case of any around the whole string.
+ if (result.length() > 1 &&
+ ((result[0] == '"' && result[result.length() - 1] == '"') ||
+ (result[0] == '\'' && result[result.length() - 1] == '\''))) {
+ // Strip first and last char which should be matching quotes now.
+ result = result.substr(1, result.length() - 2);
+ }
// First translate all path variables we recognize.
for (size_t i = 0; i < arraysize(mac_folder_mapping); ++i) {
size_t position = result.find(mac_folder_mapping[i].name);
« no previous file with comments | « no previous file | chrome/browser/policy/policy_path_parser_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698