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

Commit f186ce98 authored by Andre Eisenbach's avatar Andre Eisenbach Committed by Matthew Xie
Browse files

LE: Limit minimum MTU size

Check requested MTU sizes to ensure a minimum MTU size. Otherwise remote
devices may request an MTU that's too small, preventing any further
communication with the remote device.

Change-Id: I3ba97cf6e6c464825778a8c8902f99f6662c3762
parent 67eb2c28
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -911,10 +911,12 @@ static void gatts_process_mtu_req (tGATT_TCB *p_tcb, UINT16 len, UINT8 *p_data)
    else
    {
        /* mtu must be greater than default MTU which is 23/48 */
        if (mtu <= GATT_MAX_MTU_SIZE)
            p_tcb->payload_size = mtu;
        else
        if (mtu < GATT_DEF_BLE_MTU_SIZE)
            p_tcb->payload_size = GATT_DEF_BLE_MTU_SIZE;
        else if (mtu > GATT_MAX_MTU_SIZE)
            p_tcb->payload_size = GATT_MAX_MTU_SIZE;
        else
            p_tcb->payload_size = mtu;

        if ((p_buf = attp_build_sr_msg(p_tcb, GATT_RSP_MTU, (tGATT_SR_MSG *) &p_tcb->payload_size)) != NULL)
        {