diff options
author | Daniel Kesselberg <mail@danielkesselberg.de> | 2020-01-16 11:26:29 +0100 |
---|---|---|
committer | Daniel Kesselberg <mail@danielkesselberg.de> | 2020-01-16 11:26:29 +0100 |
commit | 8331d8296b1972224cf6e1e391bba1c9380799a5 (patch) | |
tree | 0dfdb80975279db842b42480e9bf3039ddd03935 /lib/private/AppFramework/Http | |
parent | 5de3ea04170afd25a31f249a922feb3f9b189242 (diff) | |
download | nextcloud-server-8331d8296b1972224cf6e1e391bba1c9380799a5.tar.gz nextcloud-server-8331d8296b1972224cf6e1e391bba1c9380799a5.zip |
Make getServerHost more robust to faulty user input
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'lib/private/AppFramework/Http')
-rw-r--r-- | lib/private/AppFramework/Http/Request.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php index 3563ce3a200..6554250902d 100644 --- a/lib/private/AppFramework/Http/Request.php +++ b/lib/private/AppFramework/Http/Request.php @@ -904,14 +904,14 @@ class Request implements \ArrayAccess, \Countable, IRequest { $trustedDomainHelper = new TrustedDomainHelper($this->config); if ($trustedDomainHelper->isTrustedDomain($host)) { return $host; - } else { - $trustedList = $this->config->getSystemValue('trusted_domains', []); - if(!empty($trustedList)) { - return $trustedList[0]; - } else { - return ''; - } } + + $trustedList = (array)$this->config->getSystemValue('trusted_domains', []); + if (count($trustedList) > 0) { + return reset($trustedList); + } + + return ''; } /** |