Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Giehl <stefan@matomo.org>2019-07-03 10:24:04 +0300
committerThomas Steur <tsteur@users.noreply.github.com>2019-07-03 10:24:04 +0300
commit8b7b4b2a40d25dc5011ae30b6423af360e0aa208 (patch)
tree2c8b35d3d455ea8df811a2ee2fe824e79193531a
parent47dbd8ad86dd6e6e545ff1e12a44baf3e7e0fe20 (diff)
Truncate very long useragents to prevent possible tracking slowdown (#14581)
* Truncate very long useragents to prevent possible tracking slowdown * use Common::mb_substr
-rw-r--r--core/DeviceDetectorFactory.php3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/DeviceDetectorFactory.php b/core/DeviceDetectorFactory.php
index 896132e792..b88148efee 100644
--- a/core/DeviceDetectorFactory.php
+++ b/core/DeviceDetectorFactory.php
@@ -9,6 +9,7 @@
namespace Piwik;
use DeviceDetector\DeviceDetector;
+use Piwik\Common;
class DeviceDetectorFactory
{
@@ -21,6 +22,8 @@ class DeviceDetectorFactory
*/
public static function getInstance($userAgent)
{
+ $userAgent = Common::mb_substr($userAgent, 0, 500);
+
if (array_key_exists($userAgent, self::$deviceDetectorInstances)) {
return self::$deviceDetectorInstances[$userAgent];
}