mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-29 13:46:37 +00:00
parent
9f00978a79
commit
9a670be95b
@ -1252,7 +1252,11 @@ bool LightColorEntry(char *buffer, uint8_t buffer_length)
|
|||||||
entry_type = 2; // Decimal
|
entry_type = 2; // Decimal
|
||||||
}
|
}
|
||||||
else if (((2 * light_subtype) == buffer_length) || (buffer_length > 3)) { // Hexadecimal entry
|
else if (((2 * light_subtype) == buffer_length) || (buffer_length > 3)) { // Hexadecimal entry
|
||||||
for (uint8_t i = 0; i < buffer_length / 2; i++) {
|
uint8_t limit = buffer_length / 2;
|
||||||
|
if (limit > sizeof(light_entry_color)) { // Fix buffer overflow due to too many parameters
|
||||||
|
limit = sizeof(light_entry_color);
|
||||||
|
}
|
||||||
|
for (uint8_t i = 0; i < limit; i++) {
|
||||||
strlcpy(scolor, buffer + (i *2), 3);
|
strlcpy(scolor, buffer + (i *2), 3);
|
||||||
light_entry_color[i] = (uint8_t)strtol(scolor, &p, 16);
|
light_entry_color[i] = (uint8_t)strtol(scolor, &p, 16);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user