Skip to content

Commit 742a3d8

Browse files
MechanicV1eivindj-nordic
authored andcommitted
ble_gq: updated check for invalid lenght ptr
request_process method updated with valid len pointer check to avoid crash on null pointer Signed-off-by: Nirmal Krishna <[email protected]>
1 parent badc77e commit 742a3d8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/ble_gq/gatt_queue.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ static bool request_process(const struct ble_gq_req *req, uint16_t conn_handle)
151151
break;
152152
case BLE_GQ_REQ_GATTS_HVX:
153153
LOG_DBG("GATTS notification or indication");
154+
if (!req->gatts_hvx.p_len) {
155+
LOG_DBG("GATTS HVX request p_len is NULL");
156+
err_code = NRF_ERROR_INVALID_PARAM;
157+
break;
158+
}
154159
len = *(req->gatts_hvx.p_len);
155160
err_code = sd_ble_gatts_hvx(conn_handle, &req->gatts_hvx);
156161
if (err_code == NRF_SUCCESS && len != *(req->gatts_hvx.p_len)) {

0 commit comments

Comments
 (0)