1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-14 11:59:58 +03:00

rc-modes bugfix - prevent buffer overflow when serializing box names (#13880)

This commit is contained in:
Petr Ledvina 2024-09-10 18:15:52 +02:00 committed by GitHub
parent 1382c30601
commit aa92203215
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 40 additions and 35 deletions

View file

@ -124,12 +124,10 @@ PG_DECLARE_ARRAY(modeActivationCondition_t, MAX_MODE_ACTIVATION_CONDITION_COUNT,
#if defined(USE_CUSTOM_BOX_NAMES)
#define MAX_BOX_USER_NAME_LENGTH 16
#define BOX_USER_NAME_COUNT 4
STATIC_ASSERT(BOXUSER4 + 1 - BOXUSER1 == BOX_USER_NAME_COUNT, "Invalid BOX_USER_NAME_COUNT");
typedef struct modeActivationConfig_s {
char box_user_1_name[MAX_BOX_USER_NAME_LENGTH];
char box_user_2_name[MAX_BOX_USER_NAME_LENGTH];
char box_user_3_name[MAX_BOX_USER_NAME_LENGTH];
char box_user_4_name[MAX_BOX_USER_NAME_LENGTH];
char box_user_names[BOX_USER_NAME_COUNT][MAX_BOX_USER_NAME_LENGTH];
} modeActivationConfig_t;
PG_DECLARE(modeActivationConfig_t, modeActivationConfig);