mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-18 08:51:43 +10:00
maxlength null string fix
pr#244
This commit is contained in:
+4
-5
@@ -41,7 +41,7 @@ void WiFiManagerParameter::init(const char *id, const char *placeholder, const c
|
||||
_value[i] = 0;
|
||||
}
|
||||
if (defaultValue != NULL) {
|
||||
strncpy(_value, defaultValue, length);
|
||||
strncpy(_value, defaultValue, length+1); // length+1 due to null terminated string
|
||||
}
|
||||
|
||||
_customHTML = custom;
|
||||
@@ -84,7 +84,7 @@ void WiFiManager::addParameter(WiFiManagerParameter *p) {
|
||||
// constructor
|
||||
WiFiManager::WiFiManager() {
|
||||
_usermode = WiFi.getMode();
|
||||
WiFi.persistent(false); // disable persistent so scannetworks and mode switching is not saved
|
||||
WiFi.persistent(false); // disable persistent so scannetworks and mode switching do not cause overwrites
|
||||
}
|
||||
|
||||
// destructor
|
||||
@@ -309,6 +309,7 @@ boolean WiFiManager::stopConfigPortal(){
|
||||
bool ret = WiFi.softAPdisconnect(false);
|
||||
if(!ret)DEBUG_WM(F("disconnect configportal - softAPdisconnect failed"));
|
||||
wifimode(WIFI_STA); // set back to sta, @todo use preservation variable
|
||||
WiFi.mode(_usermode);
|
||||
configPortalActive = false;
|
||||
return ret;
|
||||
}
|
||||
@@ -575,7 +576,7 @@ void WiFiManager::handleWifi(boolean scan) {
|
||||
page += item;
|
||||
delay(0);
|
||||
} else {
|
||||
DEBUG_WM(F("Skipping due to quality"));
|
||||
DEBUG_WM(F("Skipping , does not meet _minimumQuality"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -659,13 +660,11 @@ void WiFiManager::handleWifi(boolean scan) {
|
||||
|
||||
page += FPSTR(HTTP_FORM_END);
|
||||
page += FPSTR(HTTP_SCAN_LINK);
|
||||
|
||||
page += FPSTR(HTTP_END);
|
||||
|
||||
server->sendHeader("Content-Length", String(page.length()));
|
||||
server->send(200, "text/html", page);
|
||||
|
||||
|
||||
DEBUG_WM(F("Sent config page"));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ const char HTTP_HEAD_END[] PROGMEM = "</head><body><div class='right' sty
|
||||
const char HTTP_PORTAL_OPTIONS[] PROGMEM = "<form action=\"/wifi\" method=\"get\"><button>Configure WiFi</button></form><br/><form action=\"/0wifi\" method=\"get\"><button>Configure WiFi (No Scan)</button></form><br/><form action=\"/i\" method=\"get\"><button>Info</button></form><br/><form action=\"/r\" method=\"post\"><button>Reset</button></form>";
|
||||
const char HTTP_ITEM[] PROGMEM = "<div><a href='#p' onclick='c(this)'>{v}</a><div role='img' aria-label='{r}%' title='{r}%' class='q q-{q} {i}'></div></div>";
|
||||
//const char HTTP_ITEM_PADLOCK[] PROGMEM = "<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAALVBMVEX///8EBwfBwsLw8PAzNjaCg4NTVVUjJiZDRUUUFxdiZGSho6OSk5Pg4eFydHTCjaf3AAAAZElEQVQ4je2NSw7AIAhEBamKn97/uMXEGBvozkWb9C2Zx4xzWykBhFAeYp9gkLyZE0zIMno9n4g19hmdY39scwqVkOXaxph0ZCXQcqxSpgQpONa59wkRDOL93eAXvimwlbPbwwVAegLS1HGfZAAAAABJRU5ErkJggg==' width='13px'/>";
|
||||
const char HTTP_FORM_START[] PROGMEM = "<form method='get' action='wifisave'><input id='s' name='s' length=32 placeholder='SSID'><br/><input id='p' name='p' length=64 type='password' placeholder='password'><br/>";
|
||||
const char HTTP_FORM_START[] PROGMEM = "<form method='get' action='wifisave'><input id='s' name='s' maxlength=32 placeholder='SSID'><br/><input id='p' name='p' length=64 type='password' placeholder='password'><br/>";
|
||||
const char HTTP_FORM_LABEL[] PROGMEM = "<label for=\"{i}\">{p}</label>";
|
||||
const char HTTP_FORM_PARAM[] PROGMEM = "<br/><input id='{i}' name='{n}' maxlength={l} placeholder='{p}' value='{v}' {c}>";
|
||||
const char HTTP_FORM_END[] PROGMEM = "<br/><button type='submit'>save</button></form>";
|
||||
|
||||
Reference in New Issue
Block a user