mirror of
https://github.com/esphome/esphome.git
synced 2025-03-13 22:28:14 +00:00
fix: use strncpy instead of memcpy for safe string copy in add_lamp function of DynamicLampComponent
This commit is contained in:
parent
857eeb93e8
commit
9366a92354
@ -137,7 +137,7 @@ void DynamicLampComponent::add_available_output(output::FloatOutput * output, st
|
||||
void DynamicLampComponent::add_lamp(std::string name) {
|
||||
if (this->lamp_count_ < 15) {
|
||||
this->active_lamps_[this->lamp_count_].active = true;
|
||||
memcpy(this->active_lamps_[this->lamp_count_].name, name.c_str(), 16);
|
||||
strncpy(this->active_lamps_[this->lamp_count_].name, name.c_str(), 16);
|
||||
this->active_lamps_[this->lamp_count_].validation_byte = 'L';
|
||||
this->active_lamps_[this->lamp_count_].lamp_index = this->lamp_count_;
|
||||
this->active_lamps_[this->lamp_count_].used_outputs[0] = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user