]> source.dussan.org Git - nextcloud-server.git/commitdiff
Check that username and password are present. 19613/head
authorDaniel Kesselberg <mail@danielkesselberg.de>
Sun, 23 Feb 2020 17:53:17 +0000 (18:53 +0100)
committerDaniel Kesselberg <mail@danielkesselberg.de>
Sun, 23 Feb 2020 17:53:17 +0000 (18:53 +0100)
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
lib/base.php

index b0991307dda9bfbaa1999feb690e33d04e798462..1d9446856542e9e0779b2265bba16a04eea607ed 100644 (file)
@@ -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;
+                               }
                        }
                }
        }