diff --git a/bumble/gatt_server.py b/bumble/gatt_server.py index 29e4c28b..02f52a78 100644 --- a/bumble/gatt_server.py +++ b/bumble/gatt_server.py @@ -777,6 +777,18 @@ async def on_att_read_by_type_request( error_code=att.ATT_ATTRIBUTE_NOT_FOUND_ERROR, ) + if ( + request.starting_handle == 0x0000 + or request.starting_handle > request.ending_handle + ): + response = att.ATT_Error_Response( + request_opcode_in_error=request.op_code, + attribute_handle_in_error=request.starting_handle, + error_code=att.ATT_INVALID_HANDLE_ERROR, + ) + self.send_response(bearer, response) + return + attributes: list[tuple[int, bytes]] = [] for attribute in ( attribute