From 246d600f622b3adb916723eea9eba920dad26aa6 Mon Sep 17 00:00:00 2001 From: Hieromon Ikasamo Date: Tue, 22 Oct 2019 00:19:31 +0900 Subject: [PATCH] Fixed crash when no SSID found --- src/AutoConnectPage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AutoConnectPage.cpp b/src/AutoConnectPage.cpp index 974df4d..418fcd3 100644 --- a/src/AutoConnectPage.cpp +++ b/src/AutoConnectPage.cpp @@ -1157,7 +1157,7 @@ String AutoConnect::_token_LIST_SSID(PageArgument& args) { AC_DBG("%d network(s) found\n", (int)_scanCount); } // Preapre SSID list content building buffer - size_t bufSize = 192 * (_scanCount > AUTOCONNECT_SSIDPAGEUNIT_LINES ? AUTOCONNECT_SSIDPAGEUNIT_LINES : _scanCount); + size_t bufSize = sizeof('\0') + 192 * (_scanCount > AUTOCONNECT_SSIDPAGEUNIT_LINES ? AUTOCONNECT_SSIDPAGEUNIT_LINES : _scanCount); bufSize += 88 * (_scanCount > AUTOCONNECT_SSIDPAGEUNIT_LINES ? (_scanCount > (AUTOCONNECT_SSIDPAGEUNIT_LINES * 2) ? 2 : 1) : 0); char* ssidList = (char*)malloc(bufSize); if (!ssidList) {