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

Side by Side Diff: chrome/common/common_param_traits.cc

Issue 523088: Avoid accepting suspiciously long URLs from the renderer. These can take down... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 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 unified diff | Download patch
« no previous file with comments | « chrome/common/chrome_constants.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/common_param_traits.h" 5 #include "chrome/common/common_param_traits.h"
6 6
7 #include "base/gfx/rect.h" 7 #include "base/gfx/rect.h"
8 #include "chrome/common/chrome_constants.h"
8 #include "googleurl/src/gurl.h" 9 #include "googleurl/src/gurl.h"
9 #ifndef EXCLUDE_SKIA_DEPENDENCIES 10 #ifndef EXCLUDE_SKIA_DEPENDENCIES
10 #include "third_party/skia/include/core/SkBitmap.h" 11 #include "third_party/skia/include/core/SkBitmap.h"
11 #endif 12 #endif
12 #include "webkit/glue/dom_operations.h" 13 #include "webkit/glue/dom_operations.h"
13 14
14 namespace IPC { 15 namespace IPC {
15 16
16 #ifndef EXCLUDE_SKIA_DEPENDENCIES 17 #ifndef EXCLUDE_SKIA_DEPENDENCIES
17 18
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 93
93 #endif // EXCLUDE_SKIA_DEPENDENCIES 94 #endif // EXCLUDE_SKIA_DEPENDENCIES
94 95
95 void ParamTraits<GURL>::Write(Message* m, const GURL& p) { 96 void ParamTraits<GURL>::Write(Message* m, const GURL& p) {
96 m->WriteString(p.possibly_invalid_spec()); 97 m->WriteString(p.possibly_invalid_spec());
97 // TODO(brettw) bug 684583: Add encoding for query params. 98 // TODO(brettw) bug 684583: Add encoding for query params.
98 } 99 }
99 100
100 bool ParamTraits<GURL>::Read(const Message* m, void** iter, GURL* p) { 101 bool ParamTraits<GURL>::Read(const Message* m, void** iter, GURL* p) {
101 std::string s; 102 std::string s;
102 if (!m->ReadString(iter, &s)) { 103 if (!m->ReadString(iter, &s) || s.length() > chrome::kMaxURLChars) {
103 *p = GURL(); 104 *p = GURL();
104 return false; 105 return false;
105 } 106 }
106 *p = GURL(s); 107 *p = GURL(s);
107 return true; 108 return true;
108 } 109 }
109 110
110 void ParamTraits<GURL>::Log(const GURL& p, std::wstring* l) { 111 void ParamTraits<GURL>::Log(const GURL& p, std::wstring* l) {
111 l->append(UTF8ToWide(p.spec())); 112 l->append(UTF8ToWide(p.spec()));
112 } 113 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 return true; 215 return true;
215 } 216 }
216 217
217 void ParamTraits<webkit_glue::WebApplicationInfo>::Log( 218 void ParamTraits<webkit_glue::WebApplicationInfo>::Log(
218 const webkit_glue::WebApplicationInfo& p, std::wstring* l) { 219 const webkit_glue::WebApplicationInfo& p, std::wstring* l) {
219 l->append(L"<WebApplicationInfo>"); 220 l->append(L"<WebApplicationInfo>");
220 } 221 }
221 222
222 } // namespace IPC 223 } // namespace IPC
223 224
OLDNEW
« no previous file with comments | « chrome/common/chrome_constants.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698