From 3aa564cdec0318d2f1f275fad8f9db491af923aa Mon Sep 17 00:00:00 2001 From: zbchristian <33725910+zbchristian@users.noreply.github.com> Date: Tue, 31 Aug 2021 16:18:00 +0200 Subject: [PATCH] only lower case hex sequences in non-ASCII SSID --- includes/functions.php | 4 ++++ includes/wifi_functions.php | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index 8ccd2430..b4774c2f 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -765,6 +765,10 @@ function evalHexSequence($string) return preg_replace_callback('/\\\x(..)/', $evaluator, $string); } +function hexSequence2lower($string) { + return preg_replace_callback('/\\\\x([0-9A-F]{2})/', function($b){ return '\x'.strtolower($b[1]); }, $string); +} + /* File upload callback object * */ diff --git a/includes/wifi_functions.php b/includes/wifi_functions.php index b080f10f..0ff1175d 100755 --- a/includes/wifi_functions.php +++ b/includes/wifi_functions.php @@ -73,7 +73,6 @@ function nearbyWifiStations(&$networks, $cached = true) $arrNetwork = preg_split("/[\t]+/", $network); // split result into array $ssid = trim($arrNetwork[4]); - $ssid = evalHexSequence($ssid); // exclude raspap ssid if (empty($ssid) || $ssid == $ap_ssid) { @@ -117,7 +116,7 @@ function connectedWifiStations(&$networks) exec('iwconfig ' .$_SESSION['wifi_client_interface'], $iwconfig_return); foreach ($iwconfig_return as $line) { if (preg_match('/ESSID:\"([^"]+)\"/i', $line, $iwconfig_ssid)) { - $networks[$iwconfig_ssid[1]]['connected'] = true; + $networks[hexSequence2lower($iwconfig_ssid[1])]['connected'] = true; } } }