EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
forbif hex ip
Yurii4c8690f5e397
diff --git a/application/Espo/Core/Utils/Security/HostCheck.php b/application/Espo/Core/Utils/Security/HostCheck.phpindex 111420819d..bcd2f8c6bb 100644--- a/application/Espo/Core/Utils/Security/HostCheck.php+++ b/application/Espo/Core/Utils/Security/HostCheck.php@@ -166,7 +166,7 @@ class HostCheck$hasNoNumeric = false;foreach (explode('.', $host) as $it) {- if (!is_numeric($it)) {+ if (!is_numeric($it) && !self::isHex($it)) {$hasNoNumeric = true;break;@@ -175,4 +175,9 @@ class HostCheckreturn $hasNoNumeric;}++ private function isHex(string $value): bool+ {+ return preg_match('/^0x[0-9a-fA-F]+$/', $value) === 1;+ }}diff --git a/tests/unit/Espo/Core/Utils/Security/HostCheckTest.php b/tests/unit/Espo/Core/Utils/Security/HostCheckTest.phpindex 666fc3f713..d0500e310a 100644--- a/tests/unit/Espo/Core/Utils/Security/HostCheckTest.php+++ b/tests/unit/Espo/Core/Utils/Security/HostCheckTest.php@@ -65,5 +65,9 @@ class HostCheckTest extends TestCase$this->assertFalse($hostCheck->isHostAndNotInternal('0x7f000001'));++ $this->assertFalse(+ $hostCheck->isHostAndNotInternal('0x7f.1')+ );}}