From a4701ef988ca5699622b634783ce5414f26cf2ef Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Sun, 18 Apr 2021 17:29:29 +0200 Subject: [PATCH] Fix crash on partial model load (model select) --- radio/src/storage/sdcard_yaml.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/radio/src/storage/sdcard_yaml.cpp b/radio/src/storage/sdcard_yaml.cpp index 39404835c..792205e0f 100644 --- a/radio/src/storage/sdcard_yaml.cpp +++ b/radio/src/storage/sdcard_yaml.cpp @@ -138,6 +138,13 @@ const char * readModel(const char * filename, uint8_t * buffer, uint32_t size, u // YAML reader TRACE("YAML model reader"); + if (size < sizeof(g_model)) { + // TODO: Partial load for ModelButton::load() + // -> maybe we should have a summary in modelslist.yml? + memset(buffer, 0, size); + return nullptr; + } + char path[256]; getModelPath(path, filename);