diff --git a/includes/hostapd.php b/includes/hostapd.php
index 65ed5eb3..0a425cb5 100755
--- a/includes/hostapd.php
+++ b/includes/hostapd.php
@@ -217,6 +217,13 @@ if ($arrConfig['ignore_broadcast_ssid'] == 1 || $arrConfig['ignore_broadcast_ssi
+
@@ -600,6 +607,10 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status)
$good_input = false;
}
+ $_POST['max_num_sta'] = (int) $_POST['max_num_sta'];
+ $_POST['max_num_sta'] = $_POST['max_num_sta'] > 2007 ? 2007 : $_POST['max_num_sta'];
+ $_POST['max_num_sta'] = $_POST['max_num_sta'] < 1 ? null : $_POST['max_num_sta'];
+
if ($good_input) {
// Fixed values
$config = 'driver=nl80211'.PHP_EOL;
@@ -629,6 +640,9 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status)
$config.= 'wpa_pairwise='.$_POST['wpa_pairwise'].PHP_EOL;
$config.= 'country_code='.$_POST['country_code'].PHP_EOL;
$config.= 'ignore_broadcast_ssid='.$ignore_broadcast_ssid.PHP_EOL;
+ if (isset($_POST['max_num_sta'])) {
+ $config.= 'max_num_sta='.$_POST['max_num_sta'].PHP_EOL;
+ }
file_put_contents("/tmp/hostapddata", $config);
system("sudo cp /tmp/hostapddata " . RASPI_HOSTAPD_CONFIG, $return);