Merge pull request #859 from istemon/att-read-by-type-request-fix

Return 'invalid handle' for malformed read by type request
This commit is contained in:
zxzxwu
2026-01-16 15:09:20 +08:00
committed by GitHub

View File

@@ -776,6 +776,18 @@ class Server(utils.EventEmitter):
error_code=att.ATT_ATTRIBUTE_NOT_FOUND_ERROR, 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]] = [] attributes: list[tuple[int, bytes]] = []
for attribute in ( for attribute in (
attribute attribute