From c3516b54c1cd70431514c9f61402564bf02deafa Mon Sep 17 00:00:00 2001 From: Malte Langermann <54738901+gagarinlg@users.noreply.github.com> Date: Mon, 20 Feb 2023 02:01:58 +0100 Subject: [PATCH] fix(yaml): String compare not comparing to full string length (#3215) The string compare only matched the number of characters found in the yaml file, so "SLIDER1" matched "SL" on the X9E --- radio/src/storage/yaml/yaml_tree_walker.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/radio/src/storage/yaml/yaml_tree_walker.cpp b/radio/src/storage/yaml/yaml_tree_walker.cpp index 2356bbb91..8790b02bf 100644 --- a/radio/src/storage/yaml/yaml_tree_walker.cpp +++ b/radio/src/storage/yaml/yaml_tree_walker.cpp @@ -45,7 +45,8 @@ uint32_t yaml_parse_enum(const struct YamlIdStr* choices, const char* val, uint8 while (choices->str) { // we have a match! - if (!strncmp(val, choices->str, val_len)) + if( strncmp(val, choices->str, val_len) == 0 + && strlen(choices->str) == val_len) break; choices++;