mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 20:35:33 +03:00
Add missing boundary checks in vtx_common for band, channel and… (#8866)
Add missing boundary checks in vtx_common for band, channel and powerlevel index
This commit is contained in:
commit
06f682757d
1 changed files with 4 additions and 4 deletions
|
@ -148,7 +148,7 @@ bool vtxCommonGetStatus(const vtxDevice_t *vtxDevice, unsigned *status)
|
||||||
|
|
||||||
const char *vtxCommonLookupBandName(const vtxDevice_t *vtxDevice, int band)
|
const char *vtxCommonLookupBandName(const vtxDevice_t *vtxDevice, int band)
|
||||||
{
|
{
|
||||||
if (vtxDevice) {
|
if (vtxDevice && band > 0 && band <= vtxTableBandCount) {
|
||||||
return vtxTableBandNames[band];
|
return vtxTableBandNames[band];
|
||||||
} else {
|
} else {
|
||||||
return "?";
|
return "?";
|
||||||
|
@ -157,7 +157,7 @@ const char *vtxCommonLookupBandName(const vtxDevice_t *vtxDevice, int band)
|
||||||
|
|
||||||
char vtxCommonLookupBandLetter(const vtxDevice_t *vtxDevice, int band)
|
char vtxCommonLookupBandLetter(const vtxDevice_t *vtxDevice, int band)
|
||||||
{
|
{
|
||||||
if (vtxDevice) {
|
if (vtxDevice && band > 0 && band <= vtxTableBandCount) {
|
||||||
return vtxTableBandLetters[band];
|
return vtxTableBandLetters[band];
|
||||||
} else {
|
} else {
|
||||||
return '?';
|
return '?';
|
||||||
|
@ -166,7 +166,7 @@ char vtxCommonLookupBandLetter(const vtxDevice_t *vtxDevice, int band)
|
||||||
|
|
||||||
const char *vtxCommonLookupChannelName(const vtxDevice_t *vtxDevice, int channel)
|
const char *vtxCommonLookupChannelName(const vtxDevice_t *vtxDevice, int channel)
|
||||||
{
|
{
|
||||||
if (vtxDevice) {
|
if (vtxDevice && channel > 0 && channel <= vtxTableChannelCount) {
|
||||||
return vtxTableChannelNames[channel];
|
return vtxTableChannelNames[channel];
|
||||||
} else {
|
} else {
|
||||||
return "?";
|
return "?";
|
||||||
|
@ -214,7 +214,7 @@ uint16_t vtxCommonLookupFrequency(const vtxDevice_t *vtxDevice, int band, int ch
|
||||||
|
|
||||||
const char *vtxCommonLookupPowerName(const vtxDevice_t *vtxDevice, int index)
|
const char *vtxCommonLookupPowerName(const vtxDevice_t *vtxDevice, int index)
|
||||||
{
|
{
|
||||||
if (vtxDevice) {
|
if (vtxDevice && index > 0 && index <= vtxTablePowerLevels) {
|
||||||
return vtxTablePowerLabels[index];
|
return vtxTablePowerLabels[index];
|
||||||
} else {
|
} else {
|
||||||
return "?";
|
return "?";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue