mirror of
https://github.com/jeelabs/esp-link.git
synced 2026-03-24 09:56:52 +01:00
Reduced to essential
It was to much code to such a tiny task
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user