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

Commit 5b46d290 authored by Shivaprasad Hongal's avatar Shivaprasad Hongal Committed by Linux Build Service Account
Browse files

libmedia: add NULL check before accessing source and destination buffers.

IMemory can return a NULL pointer or the destination buffer for readAt can
be NULL. Check for NULL and report error.

Change-Id: I9608de8ee3817a681c5c51ec7fdbd1bf207d9463
CRs-Fixed: 931744
parent 7256509c
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -124,6 +124,14 @@ struct BpMediaHTTPConnection : public BpInterface<IMediaHTTPConnection> {
            ALOGE("got %zu, but memory has %zu", len, mMemory->size());
            return ERROR_OUT_OF_RANGE;
        }
        if(buffer == NULL) {
           ALOGE("readAt got a NULL buffer");
           return UNKNOWN_ERROR;
        }
        if (mMemory->pointer() == NULL) {
           ALOGE("readAt got a NULL mMemory->pointer()");
           return UNKNOWN_ERROR;
        }

        memcpy(buffer, mMemory->pointer(), len);