nimble/gatts: Add check for RFU bits

This commit is contained in:
Roshan
2024-02-20 18:48:54 +05:30
committed by Abhinav Kudnar
parent a6c1180ea2
commit 78ba69522b
3 changed files with 8 additions and 3 deletions
+1
View File
@@ -120,6 +120,7 @@ struct os_mbuf;
*/
/** Error Response. */
#define BLE_ATT_OP_ERROR_RSP 0x01
/** MTU Request. */
+5
View File
@@ -89,6 +89,11 @@ extern STATS_SECT_DECL(ble_gatts_stats) ble_gatts_stats;
#define BLE_GATT_CHR_DECL_SZ_16 5
#define BLE_GATT_CHR_DECL_SZ_128 19
#define BLE_GATT_CHR_CLI_SUP_FEAT_SZ 1
/**
* For now only 3 bits in first octet are defined
*
*/
#define BLE_GATT_CHR_CLI_SUP_FEAT_MASK 7
typedef uint8_t ble_gatts_conn_flags;
+2 -3
View File
@@ -2050,12 +2050,11 @@ ble_gatts_peer_cl_sup_feat_update(uint16_t conn_handle, struct os_mbuf *om)
uint16_t len;
int rc = 0;
int i;
int rfu_mask = 7;
BLE_HS_LOG(DEBUG, "");
if (!om) {
return BLE_HS_EINVAL;
return BLE_ATT_ERR_INSUFFICIENT_RES;
}
/* RFU bits are ignored so we can skip any bytes larger than supported */
@@ -2076,7 +2075,7 @@ ble_gatts_peer_cl_sup_feat_update(uint16_t conn_handle, struct os_mbuf *om)
ble_hs_lock();
conn = ble_hs_conn_find(conn_handle);
if (conn == NULL) {
rc = BLE_HS_ENOTCONN;
rc = BLE_ATT_ERR_UNLIKELY;
goto done;
}