Chromium Code Reviews| Index: third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp |
| diff --git a/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp b/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp |
| index ca7e0d04fe099047d5b8f7abd15bdf855172977a..20c6917f89cecd3e599d4b349c657c047a8e821d 100644 |
| --- a/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp |
| +++ b/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp |
| @@ -9,13 +9,16 @@ |
| namespace blink { |
| +// We limit the maximum length of the currency code to 2048 bytes for security reasons. |
| +static const int maxCurrencyCodeLength = 2048; |
| + |
| bool PaymentsValidators::isValidCurrencyCodeFormat(const String& code, String* optionalErrorMessage) |
| { |
| - if (ScriptRegexp("^[A-Z]{3}$", TextCaseSensitive).match(code) == 0) |
| + if (code.length() <= maxCurrencyCodeLength) |
| return true; |
| if (optionalErrorMessage) |
| - *optionalErrorMessage = "'" + code + "' is not a valid ISO 4217 currency code, should be 3 upper case letters [A-Z]"; |
| + *optionalErrorMessage = "The currency code is too long"; |
|
please use gerrit instead
2016/08/25 16:47:38
"The currency code should be at most 2048 characte
pals
2016/08/26 07:20:26
Done.
|
| return false; |
| } |
| @@ -26,7 +29,7 @@ bool PaymentsValidators::isValidAmountFormat(const String& amount, String* optio |
| return true; |
| if (optionalErrorMessage) |
| - *optionalErrorMessage = "'" + amount + "' is not a valid ISO 20022 CurrencyAnd30Amount"; |
| + *optionalErrorMessage = "'" + amount + "' is not a valid amount format"; |
| return false; |
| } |