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

Commit 50225445 authored by Mike Lockwood's avatar Mike Lockwood Committed by Android (Google) Code Review
Browse files

Merge "MTP: Make sure buffer is big enough before reading the data packet"

parents fefc0743 9dfc7de2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -351,6 +351,7 @@ int MtpDataPacket::read(int fd) {
        return -1;
    // then the following data
    int total = MtpPacket::getUInt32(MTP_CONTAINER_LENGTH_OFFSET);
    allocate(total);
    int remaining = total - MTP_CONTAINER_HEADER_SIZE;
    ret = ::read(fd, &mBuffer[0] + MTP_CONTAINER_HEADER_SIZE, remaining);
    if (ret != remaining)