Bluetooth: audio: Fix metadata length checks
This fixes metadata length checks for BT_AUDIO_METADATA_TYPE_EXTENDED and BT_AUDIO_METADATA_TYPE_VENDOR that should be at least 2 bytes long. Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This commit is contained in:
parent
db5767e50f
commit
17223f136f
7 changed files with 28 additions and 21 deletions
|
@ -290,9 +290,10 @@ static bool valid_metadata_type(uint8_t type, uint8_t len)
|
|||
}
|
||||
|
||||
return true;
|
||||
case BT_AUDIO_METADATA_TYPE_EXTENDED: /* 1 - 255 octets */
|
||||
case BT_AUDIO_METADATA_TYPE_VENDOR: /* 1 - 255 octets */
|
||||
if (len < 1) {
|
||||
case BT_AUDIO_METADATA_TYPE_EXTENDED: /* 2 - 255 octets */
|
||||
case BT_AUDIO_METADATA_TYPE_VENDOR: /* 2 - 255 octets */
|
||||
/* At least Extended Metadata Type / Company_ID should be there */
|
||||
if (len < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -239,9 +239,10 @@ static bool valid_metadata_type(uint8_t type, uint8_t len)
|
|||
}
|
||||
|
||||
return true;
|
||||
case BT_AUDIO_METADATA_TYPE_EXTENDED: /* 1 - 255 octets */
|
||||
case BT_AUDIO_METADATA_TYPE_VENDOR: /* 1 - 255 octets */
|
||||
if (len < 1) {
|
||||
case BT_AUDIO_METADATA_TYPE_EXTENDED: /* 2 - 255 octets */
|
||||
case BT_AUDIO_METADATA_TYPE_VENDOR: /* 2 - 255 octets */
|
||||
/* At least Extended Metadata Type / Company_ID should be there */
|
||||
if (len < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -431,9 +431,10 @@ static bool valid_metadata_type(uint8_t type, uint8_t len)
|
|||
}
|
||||
|
||||
return true;
|
||||
case BT_AUDIO_METADATA_TYPE_EXTENDED: /* 1 - 255 octets */
|
||||
case BT_AUDIO_METADATA_TYPE_VENDOR: /* 1 - 255 octets */
|
||||
if (len < 1) {
|
||||
case BT_AUDIO_METADATA_TYPE_EXTENDED: /* 2 - 255 octets */
|
||||
case BT_AUDIO_METADATA_TYPE_VENDOR: /* 2 - 255 octets */
|
||||
/* At least Extended Metadata Type / Company_ID should be there */
|
||||
if (len < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -511,9 +511,10 @@ static bool valid_metadata_type(uint8_t type, uint8_t len)
|
|||
}
|
||||
|
||||
return true;
|
||||
case BT_AUDIO_METADATA_TYPE_EXTENDED: /* 1 - 255 octets */
|
||||
case BT_AUDIO_METADATA_TYPE_VENDOR: /* 1 - 255 octets */
|
||||
if (len < 1) {
|
||||
case BT_AUDIO_METADATA_TYPE_EXTENDED: /* 2 - 255 octets */
|
||||
case BT_AUDIO_METADATA_TYPE_VENDOR: /* 2 - 255 octets */
|
||||
/* At least Extended Metadata Type / Company_ID should be there */
|
||||
if (len < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -353,9 +353,10 @@ static bool valid_metadata_type(uint8_t type, uint8_t len, const uint8_t *data)
|
|||
}
|
||||
|
||||
return true;
|
||||
case BT_AUDIO_METADATA_TYPE_EXTENDED: /* 1 - 255 octets */
|
||||
case BT_AUDIO_METADATA_TYPE_VENDOR: /* 1 - 255 octets */
|
||||
if (len < 1) {
|
||||
case BT_AUDIO_METADATA_TYPE_EXTENDED: /* 2 - 255 octets */
|
||||
case BT_AUDIO_METADATA_TYPE_VENDOR: /* 2 - 255 octets */
|
||||
/* At least Extended Metadata Type / Company_ID should be there */
|
||||
if (len < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -182,9 +182,10 @@ static bool valid_metadata_type(uint8_t type, uint8_t len)
|
|||
}
|
||||
|
||||
return true;
|
||||
case BT_AUDIO_METADATA_TYPE_EXTENDED: /* 1 - 255 octets */
|
||||
case BT_AUDIO_METADATA_TYPE_VENDOR: /* 1 - 255 octets */
|
||||
if (len < 1) {
|
||||
case BT_AUDIO_METADATA_TYPE_EXTENDED: /* 2 - 255 octets */
|
||||
case BT_AUDIO_METADATA_TYPE_VENDOR: /* 2 - 255 octets */
|
||||
/* At least Extended Metadata Type / Company_ID should be there */
|
||||
if (len < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -347,9 +347,10 @@ static bool valid_metadata_type(uint8_t type, uint8_t len)
|
|||
}
|
||||
|
||||
return true;
|
||||
case BT_AUDIO_METADATA_TYPE_EXTENDED: /* 1 - 255 octets */
|
||||
case BT_AUDIO_METADATA_TYPE_VENDOR: /* 1 - 255 octets */
|
||||
if (len < 1) {
|
||||
case BT_AUDIO_METADATA_TYPE_EXTENDED: /* 2 - 255 octets */
|
||||
case BT_AUDIO_METADATA_TYPE_VENDOR: /* 2 - 255 octets */
|
||||
/* At least Extended Metadata Type / Company_ID should be there */
|
||||
if (len < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue