Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/io/vtx_smartaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static serialPort_t *smartAudioSerialPort = NULL;

uint8_t saPowerCount = VTX_SMARTAUDIO_DEFAULT_POWER_COUNT;
const char *saPowerNames[VTX_SMARTAUDIO_MAX_POWER_COUNT + 1] = {
"----", "25 ", "200 ", "500 ", "800 ", " ", " ", " ", " "
"25", "200 ", "500 ", "1000 ", "3000 ", " ", " ", " ", " "
};
Comment on lines 64 to 66
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Truncate the power name strings to a maximum of 4 characters to prevent a potential buffer overflow when they are copied into the sa21PowerNames buffer. [possible issue, importance: 9]

Suggested change
const char *saPowerNames[VTX_SMARTAUDIO_MAX_POWER_COUNT + 1] = {
"----", "25 ", "200 ", "500 ", "800 ", " ", " ", " ", " "
"25", "200 ", "500 ", "1000 ", "3000 ", " ", " ", " ", " "
};
const char *saPowerNames[VTX_SMARTAUDIO_MAX_POWER_COUNT + 1] = {
"25", "200", "500", "1000", "3000", " ", " ", " ", " "
};


// Save powerlevels reported from SA 2.1 devices here
Expand Down