From f7d5789b0eff96af1169003635eb057e4c135b85 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 5 Oct 2022 12:32:24 +1100 Subject: [PATCH] AP_Param: fixed handling of long lines in defaults.parm lines longer than 100 bytes were causing the parsing to stop --- libraries/AP_Param/AP_Param.cpp | 35 ++++++++++++++------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/libraries/AP_Param/AP_Param.cpp b/libraries/AP_Param/AP_Param.cpp index c29871e44c..d2fd2e3b71 100644 --- a/libraries/AP_Param/AP_Param.cpp +++ b/libraries/AP_Param/AP_Param.cpp @@ -2299,28 +2299,25 @@ bool AP_Param::load_defaults_file(const char *filename, bool last_pass) bool AP_Param::count_embedded_param_defaults(uint16_t &count) { const volatile char *ptr = param_defaults_data.data; - uint16_t length = param_defaults_data.length; + int32_t length = param_defaults_data.length; count = 0; - while (length) { + while (length>0) { char line[100]; char *pname; float value; bool read_only; uint16_t i; - uint16_t n = MIN(length, sizeof(line)-1); + uint16_t n = length; for (i=0;i 0) { char line[100]; char *pname; float value; bool read_only; uint16_t i; - uint16_t n = MIN(length, sizeof(line)-1); + uint16_t n = length; for (i=0;i