Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bafbd718 authored by Brian Delwiche's avatar Brian Delwiche
Browse files

Fix crash in l2cap-fuzzer

l2cap-fuzzer initializes itself via L2CA_RegisterWithSecurity, which calls through into BTM_SetSecurityLevel.  For the client interface defined for these fuzzers, BTM_SetSecurityLevel is nullptr, which leads to a crash on startup.

Add a mock for this in the default client interface.

Bug: 326853665
Test: m libbluetooth
Test: l2cap-fuzzer
Flag: EXEMPT test_only
Change-Id: I282db97b683efb1ba2596d4fad0070215f4cb62c
parent 9d0a929c
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -142,6 +142,10 @@ struct btm_client_interface_t default_btm_client_interface = {
                },
                .BTM_IsLinkKeyKnown = [](const RawAddress& /* bd_addr */,
                                         tBT_TRANSPORT /* transport */) -> bool { return false; },
                .BTM_SetSecurityLevel = [](bool /* is_originator */, const char* /*p_name */,
                                           uint8_t /* service_id */, uint16_t /* sec_level */,
                                           uint16_t /* psm */, uint32_t /* mx_proto_id */,
                                           uint32_t /* mx_chan_id */) -> bool { return false; },
                .BTM_SecClrService = [](uint8_t /* service_id */) -> uint8_t { return 0; },
                .BTM_SecClrServiceByPsm = [](uint16_t /* psm */) -> uint8_t { return 0; },
                .BTM_SecBond = [](const RawAddress& /* bd_addr */, tBLE_ADDR_TYPE /* addr_type */,
@@ -150,7 +154,6 @@ struct btm_client_interface_t default_btm_client_interface = {
                .BTM_SecBondCancel = [](const RawAddress& /* bd_addr */) -> tBTM_STATUS {
                  return tBTM_STATUS::BTM_SUCCESS;
                },

                .BTM_RemoteOobDataReply = [](tBTM_STATUS /* res */, const RawAddress& /* bd_addr */,
                                             const Octet16& /* c */, const Octet16& /* r */) {},
                .BTM_PINCodeReply = [](const RawAddress& /* bd_addr */, tBTM_STATUS /* res */,