diff options
| author | Ben Murdoch <benm@google.com> | 2010-11-18 18:32:45 +0000 |
|---|---|---|
| committer | Ben Murdoch <benm@google.com> | 2010-11-18 18:38:07 +0000 |
| commit | 513209b27ff55e2841eac0e4120199c23acce758 (patch) | |
| tree | aeba30bb08c5f47c57003544e378a377c297eee6 /chrome/browser/autocomplete_history_manager.cc | |
| parent | 164f7496de0fbee436b385a79ead9e3cb81a50c1 (diff) | |
| download | external_chromium-513209b27ff55e2841eac0e4120199c23acce758.zip external_chromium-513209b27ff55e2841eac0e4120199c23acce758.tar.gz external_chromium-513209b27ff55e2841eac0e4120199c23acce758.tar.bz2 | |
Merge Chromium at r65505: Initial merge by git.
Change-Id: I31d8f1d8cd33caaf7f47ffa7350aef42d5fbdb45
Diffstat (limited to 'chrome/browser/autocomplete_history_manager.cc')
| -rw-r--r-- | chrome/browser/autocomplete_history_manager.cc | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/chrome/browser/autocomplete_history_manager.cc b/chrome/browser/autocomplete_history_manager.cc index b2c4d3c..2243bcb 100644 --- a/chrome/browser/autocomplete_history_manager.cc +++ b/chrome/browser/autocomplete_history_manager.cc @@ -31,8 +31,6 @@ const string16 kSSNSeparators = ASCIIToUTF16(" -"); bool IsSSN(const string16& text) { string16 number_string; RemoveChars(text, kSSNSeparators.c_str(), &number_string); - if (number_string.length() != 9 || !IsStringASCII(number_string)) - return false; // A SSN is of the form AAA-GG-SSSS (A = area number, G = group number, S = // serial number). The validation we do here is simply checking if the area, @@ -42,13 +40,13 @@ bool IsSSN(const string16& text) { // See: http://www.socialsecurity.gov/history/ssn/geocard.html // http://www.socialsecurity.gov/employer/stateweb.htm // http://www.socialsecurity.gov/employer/ssnvhighgroup.htm - - string16 area_string = number_string.substr(0, 3); - string16 group_string = number_string.substr(3, 2); - string16 serial_string = number_string.substr(5, 4); + if (number_string.length() != 9 || !IsStringASCII(number_string)) + return false; int area; - if (!base::StringToInt(area_string, &area)) + if (!base::StringToInt(number_string.begin(), + number_string.begin() + 3, + &area)) return false; if (area < 1 || area == 666 || @@ -57,11 +55,15 @@ bool IsSSN(const string16& text) { return false; int group; - if (!base::StringToInt(group_string, &group) || group == 0) + if (!base::StringToInt(number_string.begin() + 3, + number_string.begin() + 5, + &group) || group == 0) return false; int serial; - if (!base::StringToInt(serial_string, &serial) || serial == 0) + if (!base::StringToInt(number_string.begin() + 5, + number_string.begin() + 9, + &serial) || serial == 0) return false; return true; |
