summaryrefslogtreecommitdiffstats
path: root/chrome/common/common_param_traits.cc
diff options
context:
space:
mode:
authorcevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-08 00:08:22 +0000
committercevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-08 00:08:22 +0000
commit7bd904b2052fe21762ae7cd2ee70e829eb5524e0 (patch)
tree5d305c7bf13d460695b31fce7f600110d5ec0721 /chrome/common/common_param_traits.cc
parentba3ccd34fe2a47f1fe58126dc482c1b43ed00361 (diff)
downloadchromium_src-7bd904b2052fe21762ae7cd2ee70e829eb5524e0.zip
chromium_src-7bd904b2052fe21762ae7cd2ee70e829eb5524e0.tar.gz
chromium_src-7bd904b2052fe21762ae7cd2ee70e829eb5524e0.tar.bz2
Avoid accepting suspiciously long URLs from the renderer. These can take down
the browser with OOM. BUG=20233 TEST=NONE Review URL: http://codereview.chromium.org/523088 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35757 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/common_param_traits.cc')
-rw-r--r--chrome/common/common_param_traits.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/chrome/common/common_param_traits.cc b/chrome/common/common_param_traits.cc
index 684337d..5e6880e3 100644
--- a/chrome/common/common_param_traits.cc
+++ b/chrome/common/common_param_traits.cc
@@ -5,6 +5,7 @@
#include "chrome/common/common_param_traits.h"
#include "base/gfx/rect.h"
+#include "chrome/common/chrome_constants.h"
#include "googleurl/src/gurl.h"
#ifndef EXCLUDE_SKIA_DEPENDENCIES
#include "third_party/skia/include/core/SkBitmap.h"
@@ -99,7 +100,7 @@ void ParamTraits<GURL>::Write(Message* m, const GURL& p) {
bool ParamTraits<GURL>::Read(const Message* m, void** iter, GURL* p) {
std::string s;
- if (!m->ReadString(iter, &s)) {
+ if (!m->ReadString(iter, &s) || s.length() > chrome::kMaxURLChars) {
*p = GURL();
return false;
}