Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion adminer/include/auth.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function auth_error(string $error, array &$permanent) {
$connection = '';
if (isset($_GET["username"]) && is_string(get_password())) {
list($host, $port) = host_port(SERVER);
if (!preg_match('~^[-a-z0-9.:]*$~Di', $host) || !preg_match('~^[-\w./]*$~D', $port)) {
if (!preg_match('~^[-a-z0-9.:]*$~Di', $host) || !preg_match('~^[-\w.:/]*$~D', $port)) {
auth_error(lang('Invalid server.'), $permanent);
}
if (preg_match('~^-?\d+~', $port, $match) && ($match[0] < 1024 || $match[0] > 65535)) { // is_numeric('80.') would still connect to port 80
Expand Down
2 changes: 1 addition & 1 deletion adminer/include/functions.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ function is_shortable(array $field): bool {
* @return array{0: string, 1: string}
*/
function host_port(string $server) {
return (preg_match('~^(\[(.+)]|([^:]*)):([^:]+)$~', $server, $match) // [a:b] - IPv6
return (preg_match('~^(\[(.+)]|([^:]*)):(\d+|/.+)$~', $server, $match) // [a:b] - IPv6
? array($match[2] . $match[3], $match[4])
: array($server, '')
);
Expand Down
Loading