Chromium Code Reviews| Index: src/url_canon_ip.cc |
| =================================================================== |
| --- src/url_canon_ip.cc (revision 133) |
| +++ src/url_canon_ip.cc (working copy) |
| @@ -58,11 +58,14 @@ |
| bool DoFindIPv4Components(const CHAR* spec, |
| const url_parse::Component& host, |
| url_parse::Component components[4]) { |
| + if (!host.is_nonempty()) |
| + return false; |
| + |
| int cur_component = 0; // Index of the component we're working on. |
| int cur_component_begin = host.begin; // Start of the current component. |
| int end = host.end(); |
| for (int i = host.begin; /* nothing */; i++) { |
| - if (i == end || spec[i] == '.') { |
| + if (i >= end || spec[i] == '.') { |
| // Found the end of the current component. |
| int component_len = i - cur_component_begin; |
| components[cur_component] = |
| @@ -79,7 +82,7 @@ |
| if (component_len == 0 && (i != end || cur_component == 1)) |
|
Peter Kasting
2010/05/11 18:34:33
You should change "i != end" to "i < end" here.
|
| return false; |
| - if (i == end) |
| + if (i >= end) |
| break; // End of the input. |
| if (cur_component == 4) { |