avdtp_util: fix SBC block length and subbands validation

This commit is contained in:
Milanka Ringwald 2024-12-11 11:43:38 +01:00 committed by Matthias Ringwald
parent a09eff8155
commit 858500b1d8

View File

@ -1574,18 +1574,19 @@ uint8_t avdtp_config_sbc_store(uint8_t * config, const avdtp_configuration_sbc_t
if (configuration->allocation_method > AVDTP_SBC_ALLOCATION_METHOD_SNR){ if (configuration->allocation_method > AVDTP_SBC_ALLOCATION_METHOD_SNR){
return ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE; return ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE;
} }
switch (configuration->block_length){
case 4: switch ((avdtp_sbc_block_length_t)configuration->block_length){
case 8: case AVDTP_SBC_BLOCK_LENGTH_4:
case 12: case AVDTP_SBC_BLOCK_LENGTH_8:
case 16: case AVDTP_SBC_BLOCK_LENGTH_12:
case AVDTP_SBC_BLOCK_LENGTH_16:
break; break;
default: default:
return ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE; return ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE;
} }
switch (configuration->subbands){ switch ((avdtp_sbc_subbands_t)configuration->subbands){
case 4: case AVDTP_SBC_SUBBANDS_4:
case 8: case AVDTP_SBC_SUBBANDS_8:
break; break;
default: default:
return ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE; return ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE;