Index: chrome/browser/policy/policy_path_parser_posix.cc |
diff --git a/chrome/browser/policy/policy_path_parser_posix.cc b/chrome/browser/policy/policy_path_parser_posix.cc |
index 6b9df82305114fc2d4bb532f88a28d3ea9162da5..2f9ea26b5df1e0c952da2570c43ad81bcc47ba7e 100644 |
--- a/chrome/browser/policy/policy_path_parser_posix.cc |
+++ b/chrome/browser/policy/policy_path_parser_posix.cc |
@@ -20,6 +20,15 @@ const char* kUserNamePolicyVarName = "${user_name}"; |
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); |
+ } |
// Translate two special variables ${user_name} and ${machine_name} |
size_t position = result.find(kUserNamePolicyVarName); |
if (position != std::string::npos) { |