AP_Param: correct maximum-length parameter sanity check
need to take into account addition of (eg.) _X suffix for VECTOR3F parameters
This commit is contained in:
parent
a6769e003a
commit
efba110ef9
@ -268,7 +268,12 @@ void AP_Param::check_group_info(const struct AP_Param::GroupInfo * group_info,
|
||||
if (size == 0) {
|
||||
FATAL("invalid type in %s", group_info[i].name);
|
||||
}
|
||||
if (prefix_length + strlen(group_info[i].name) > 16) {
|
||||
uint8_t param_name_length = prefix_length + strlen(group_info[i].name);
|
||||
if (type == AP_PARAM_VECTOR3F) {
|
||||
// need room for _X/_Y/_Z
|
||||
param_name_length += 2;
|
||||
}
|
||||
if (param_name_length > 16) {
|
||||
FATAL("suffix is too long in %s", group_info[i].name);
|
||||
}
|
||||
(*total_size) += size + sizeof(struct Param_header);
|
||||
|
Loading…
Reference in New Issue
Block a user