luci-base: Code quality fixes
authorPaul Donald <newtwen@gmail.com>
Wed, 31 Jan 2024 01:04:27 +0000 (02:04 +0100)
committerPaul Donald <newtwen@gmail.com>
Sat, 3 Feb 2024 15:14:44 +0000 (16:14 +0100)
reduce backtracking in regex

Signed-off-by: Paul Donald <newtwen@gmail.com>
(cherry picked from commit 2dc1fccbd1f46d3fa2689cc1eae3899e5a807a4f)

modules/luci-base/htdocs/luci-static/resources/validation.js

index 791a84823d4c1ec49157bb22e6165bdc01842d81..9504e7f2c42678777a20392f6ee332c95f84d9b9 100644 (file)
@@ -589,7 +589,7 @@ var ValidatorFactory = baseclass.extend({
                },
 
                hexstring: function() {
-                       return this.assert(this.value.match(/^([a-f0-9][a-f0-9]|[A-F0-9][A-F0-9])+$/),
+                       return this.assert(this.value.match(/^([A-F0-9]{2})+$/i),
                                _('hexadecimal encoded value'));
                },