Skip to content

Commit efba110

Browse files
committed
AP_Param: correct maximum-length parameter sanity check
need to take into account addition of (eg.) _X suffix for VECTOR3F parameters
1 parent a6769e0 commit efba110

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

libraries/AP_Param/AP_Param.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,12 @@ void AP_Param::check_group_info(const struct AP_Param::GroupInfo * group_info,
268268
if (size == 0) {
269269
FATAL("invalid type in %s", group_info[i].name);
270270
}
271-
if (prefix_length + strlen(group_info[i].name) > 16) {
271+
uint8_t param_name_length = prefix_length + strlen(group_info[i].name);
272+
if (type == AP_PARAM_VECTOR3F) {
273+
// need room for _X/_Y/_Z
274+
param_name_length += 2;
275+
}
276+
if (param_name_length > 16) {
272277
FATAL("suffix is too long in %s", group_info[i].name);
273278
}
274279
(*total_size) += size + sizeof(struct Param_header);

0 commit comments

Comments
 (0)