From 8adfcb6e6007a2cedca89dad5b3fc933f0c2c12d Mon Sep 17 00:00:00 2001 From: KatAst Date: Sat, 2 Jan 2016 12:51:35 +0100 Subject: [PATCH] Reduced to essential It was to much code to such a tiny task --- esp-link/cgiwifi.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/esp-link/cgiwifi.c b/esp-link/cgiwifi.c index 8c6b33e..f61ca0e 100644 --- a/esp-link/cgiwifi.c +++ b/esp-link/cgiwifi.c @@ -823,25 +823,17 @@ int ICACHE_FLASH_ATTR cgiWifiInfo(HttpdConnData *connData) { // Check string againt invalid characters int ICACHE_FLASH_ATTR checkString(char *str){ - unsigned char strStripped[50]; - int i = 0, c = 0; + int i = 0; for(; i < os_strlen(str); i++) { // Alphanumeric and underscore allowed - if (isalnum((unsigned char)str[i]) || str[i] == '_') + if (!(isalnum((unsigned char)str[i]) || str[i] == '_')) { - strStripped[c] = str[i]; - c++; + os_printf("Error: String has non alphanumeric chars\n"); + return 0; } } - strStripped[c] = '\0'; - - if (os_strcmp((char *)str,(char *)&strStripped) == 0){ - return 1; - }else{ - os_printf("Error: String has non alphanumeric chars\n"); - return 0; - } + return 1; } /* Init the wireless