summaryrefslogtreecommitdiffstats
path: root/base/file_util_win.cc
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 /base/file_util_win.cc
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 'base/file_util_win.cc')
-rw-r--r--base/file_util_win.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index 32b6811..8f76c5c 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -306,6 +306,10 @@ bool CreateShortcutLink(const wchar_t *source, const wchar_t *destination,
const wchar_t *working_dir, const wchar_t *arguments,
const wchar_t *description, const wchar_t *icon,
int icon_index, const wchar_t* app_id) {
+ // Length of arguments and description must be less than MAX_PATH.
+ DCHECK(lstrlen(arguments) < MAX_PATH);
+ DCHECK(lstrlen(description) < MAX_PATH);
+
ScopedComPtr<IShellLink> i_shell_link;
ScopedComPtr<IPersistFile> i_persist_file;
@@ -353,6 +357,10 @@ bool UpdateShortcutLink(const wchar_t *source, const wchar_t *destination,
const wchar_t *working_dir, const wchar_t *arguments,
const wchar_t *description, const wchar_t *icon,
int icon_index, const wchar_t* app_id) {
+ // Length of arguments and description must be less than MAX_PATH.
+ DCHECK(lstrlen(arguments) < MAX_PATH);
+ DCHECK(lstrlen(description) < MAX_PATH);
+
// Get pointer to the IPersistFile interface and load existing link
ScopedComPtr<IShellLink> i_shell_link;
if (FAILED(i_shell_link.CreateInstance(CLSID_ShellLink, NULL,