summaryrefslogtreecommitdiffstats
path: root/chrome/browser/web_applications
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-23 01:17:35 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-23 01:17:35 +0000
commit4349dcf41a371acd0ca85fa48fa46995186d2059 (patch)
treebeef3b992021678adf0a7304f7c0bc931735e7cd /chrome/browser/web_applications
parent34e13c29bd983b7f6694c2d44162260a6de32b62 (diff)
downloadchromium_src-4349dcf41a371acd0ca85fa48fa46995186d2059.zip
chromium_src-4349dcf41a371acd0ca85fa48fa46995186d2059.tar.gz
chromium_src-4349dcf41a371acd0ca85fa48fa46995186d2059.tar.bz2
Fix app shortcut mess up per issue 31789
Issue 31789 is caused by a longer than MAX_PATH chars web app description. Fix it by limiting the description string size to MAX_PATH. Note: 1. MSDN mentions that the size limitation for Win2000 or later is INFOTIPSIZE but the limit on my vista dev machine is MAX_PATH. <http://msdn.microsoft.com/en-us/library/bb774955(VS.85).aspx> 2. The size limit includes the terminating NULL. BUG=31789 TEST=Verify fix for issue 31789. facebook.com has a 261-char description and chromium should be able to create a working shortcut for it. Review URL: http://codereview.chromium.org/650186 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39686 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/web_applications')
-rw-r--r--chrome/browser/web_applications/web_app.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc
index 95186e9..a8ef292 100644
--- a/chrome/browser/web_applications/web_app.cc
+++ b/chrome/browser/web_applications/web_app.cc
@@ -356,6 +356,10 @@ bool CreateShortcutTask::CreateShortcut() {
shortcut_info_.extension_id);
std::wstring wide_switchs(UTF8ToWide(switches));
+ // Sanitize description
+ if (shortcut_info_.description.length() >= MAX_PATH)
+ shortcut_info_.description.resize(MAX_PATH - 1);
+
// Generates app id from web app url and profile path.
std::wstring app_id = ShellIntegration::GetAppId(
web_app::GenerateApplicationNameFromURL(shortcut_info_.url).c_str(),
@@ -599,6 +603,10 @@ void UpdateShortcutWorker::UpdateShortcutsOnFileThread() {
web_app::GenerateApplicationNameFromURL(shortcut_info_.url).c_str(),
profile_path_);
+ // Sanitize description
+ if (shortcut_info_.description.length() >= MAX_PATH)
+ shortcut_info_.description.resize(MAX_PATH - 1);
+
for (size_t i = 0; i < shortcut_files_.size(); ++i) {
file_util::UpdateShortcutLink(NULL,
shortcut_files_[i].value().c_str(),