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

Unified Diff: net/base/escape.cc

Issue 408: Fix an out of band read when parsing a URL component of just "%". The... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/base/escape_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/escape.cc
===================================================================
--- net/base/escape.cc (revision 1665)
+++ net/base/escape.cc (working copy)
@@ -113,9 +113,8 @@
std::string result;
result.reserve(escaped_text.length());
- for (size_t i = 0, max = escaped_text.size(), max_digit_index = max - 2;
- i < max; ++i) {
- if (escaped_text[i] == '%' && i < max_digit_index) {
+ for (size_t i = 0, max = escaped_text.size(); i < max; ++i) {
+ if (escaped_text[i] == '%' && i + 2 < max) {
const std::string::value_type most_sig_digit(escaped_text[i + 1]);
const std::string::value_type least_sig_digit(escaped_text[i + 2]);
if (IsHex(most_sig_digit) && IsHex(least_sig_digit)) {
« no previous file with comments | « no previous file | net/base/escape_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698