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

Commit 379ff180 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Stricter check of the MTU size in the BTIF L2CAP socket

Test: manual
Bug: 68359837
Change-Id: I0056044388f8886f704a9ff2f30db09b3110d143
parent c170afe3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1004,11 +1004,11 @@ void btsock_l2cap_signaled(int fd, int flags, uint32_t user_id) {
        ssize_t count;
        OSI_NO_INTR(count = recv(fd, get_l2cap_sdu_start_ptr(buffer), size,
                                 MSG_NOSIGNAL | MSG_DONTWAIT | MSG_TRUNC));
        if (count > L2CAP_LE_MAX_MPS) {
        if (count > sock->mtu) {
          /* This can't happen thanks to check in BluetoothSocket.java but leave
           * this in case this socket is ever used anywhere else*/
          LOG(ERROR) << "recv more than MTU. Data will be lost: " << count;
          count = L2CAP_LE_MAX_MPS;
          count = sock->mtu;
        }

        /* When multiple packets smaller than MTU are flushed to the socket, the