Reduced to essential

It was to much code to such a tiny task
pull/84/head
KatAst 9 years ago
parent 5f8da7e2b0
commit 8adfcb6e60
  1. 18
      esp-link/cgiwifi.c

@ -823,25 +823,17 @@ int ICACHE_FLASH_ATTR cgiWifiInfo(HttpdConnData *connData) {
// Check string againt invalid characters // Check string againt invalid characters
int ICACHE_FLASH_ATTR checkString(char *str){ int ICACHE_FLASH_ATTR checkString(char *str){
unsigned char strStripped[50]; int i = 0;
int i = 0, c = 0;
for(; i < os_strlen(str); i++) for(; i < os_strlen(str); i++)
{ {
// Alphanumeric and underscore allowed // Alphanumeric and underscore allowed
if (isalnum((unsigned char)str[i]) || str[i] == '_') if (!(isalnum((unsigned char)str[i]) || str[i] == '_'))
{ {
strStripped[c] = str[i]; os_printf("Error: String has non alphanumeric chars\n");
c++; return 0;
} }
} }
strStripped[c] = '\0'; return 1;
if (os_strcmp((char *)str,(char *)&strStripped) == 0){
return 1;
}else{
os_printf("Error: String has non alphanumeric chars\n");
return 0;
}
} }
/* Init the wireless /* Init the wireless

Loading…
Cancel
Save