From 4086e46f6ca7b894d9671c33f1b89f3310ef0717 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Mon, 24 Jan 2022 14:13:03 -0600 Subject: [PATCH] fix param out of scope check, avoids some exceptions --- WiFiManager.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 5f26ae6..87ee235 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -1625,15 +1625,20 @@ String WiFiManager::getParamOut(){ bool tok_c = HTTP_PARAM_temp.indexOf(FPSTR(T_c)) > 0; char valLength[5]; - // add the extra parameters to the form + for (int i = 0; i < _paramsCount; i++) { - if (_params[i] == NULL || _params[i]->_length == 0) { + Serial.println((String)_params[i]->_length); + if (_params[i] == NULL || _params[i]->_length == 0 || _params[i]->_length > 99999) { + // try to detect param scope issues, doesnt always catch but works ok #ifdef WM_DEBUG_LEVEL DEBUG_WM(DEBUG_ERROR,F("[ERROR] WiFiManagerParameter is out of scope")); #endif - break; + return ""; } + } + // add the extra parameters to the form + for (int i = 0; i < _paramsCount; i++) { // label before or after, @todo this could be done via floats or CSS and eliminated String pitem; switch (_params[i]->getLabelPlacement()) {