From 0a59a57d912d62d583ce8ad6286346a918a79a0f Mon Sep 17 00:00:00 2001 From: Jonathan Challinger Date: Fri, 7 Sep 2018 18:55:58 -0700 Subject: [PATCH] param: fix bug with param names that are substrings of other param names --- modules/param/param.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/param/param.c b/modules/param/param.c index d8568d77..74d3bfa7 100644 --- a/modules/param/param.c +++ b/modules/param/param.c @@ -153,10 +153,14 @@ enum param_type_t param_get_type_by_index(uint16_t param_idx) { } int16_t param_get_index_by_name(uint8_t name_len, char* name) { + if (name_len > 92) { + return -1; + } + for (uint16_t i=0; iname, MIN(name_len,92))) { + if(!strncmp(name, descriptor->name, name_len) && name_len == strnlen(descriptor->name, 92)) { return i; } }