From: Daniel Kesselberg Date: Sun, 23 Feb 2020 17:53:17 +0000 (+0100) Subject: Check that username and password are present. X-Git-Tag: v19.0.0beta1~198^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=56efd687abf4551d782114175e0ff2567e16aad2;p=nextcloud-server.git Check that username and password are present. Signed-off-by: Daniel Kesselberg --- diff --git a/lib/base.php b/lib/base.php index b0991307dda..1d944685654 100644 --- a/lib/base.php +++ b/lib/base.php @@ -1077,10 +1077,12 @@ class OC { ); foreach ($vars as $var) { if (isset($_SERVER[$var]) && preg_match('/Basic\s+(.*)$/i', $_SERVER[$var], $matches)) { - list($name, $password) = explode(':', base64_decode($matches[1]), 2); - $_SERVER['PHP_AUTH_USER'] = $name; - $_SERVER['PHP_AUTH_PW'] = $password; - break; + $credentials = explode(':', base64_decode($matches[1]), 2); + if (count($credentials) === 2) { + $_SERVER['PHP_AUTH_USER'] = $credentials[0]; + $_SERVER['PHP_AUTH_PW'] = $credentials[1]; + break; + } } } }