mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-25 19:56:30 +00:00
CommandHandler() optimize and maybe security fix
This commit is contained in:
parent
24eff9108b
commit
4c0a85ba0f
@ -204,13 +204,18 @@ void CommandHandler(char* topicBuf, char* dataBuf, uint32_t data_len)
|
|||||||
if (type != nullptr) {
|
if (type != nullptr) {
|
||||||
type++;
|
type++;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
for (i = 0; i < strlen(type); i++) {
|
int nLen; // strlen(type)
|
||||||
type[i] = toupper(type[i]);
|
char *s = type;
|
||||||
|
for (nLen = 0; *s; s++, nLen++) {
|
||||||
|
*s=toupper(*s);
|
||||||
}
|
}
|
||||||
|
i = nLen;
|
||||||
|
if (i > 0) { // may be 0
|
||||||
while (isdigit(type[i-1])) {
|
while (isdigit(type[i-1])) {
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
if (i < strlen(type)) {
|
}
|
||||||
|
if (i < nLen) {
|
||||||
index = atoi(type + i);
|
index = atoi(type + i);
|
||||||
user_index = true;
|
user_index = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user