fix(colorlcd): EM crash when clearing Model Category name (#1897) (#1925)

* Merge branch 'main' into eshifri/preserve_current_rebase

* Initialize category name to zero. Without it KEY_ENTER adds garbage.
This commit is contained in:
eshifri
2022-05-04 18:15:24 +10:00
committed by GitHub
parent b9d9f61456
commit 87021209b3
2 changed files with 5 additions and 4 deletions
+3 -1
View File
@@ -187,6 +187,7 @@ bool ModelCell::fetchRfData()
ModelsCategory::ModelsCategory(const char * name)
{
memset(this->name, 0, sizeof(this->name));
strncpy(this->name, name, sizeof(this->name));
}
@@ -194,7 +195,8 @@ ModelsCategory::ModelsCategory(const char * name, uint8_t len)
{
if (len > sizeof(this->name)-1)
len = sizeof(this->name)-1;
memset(this->name, 0, sizeof(this->name));
memcpy(this->name, name, len);
this->name[len] = '\0';
}