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

Commit 223c620f authored by Yan, Shaopu's avatar Yan, Shaopu Committed by android-build-merger
Browse files

Merge "add null pointer check for msg buffer" am: f03f2a5c am: a3e48767

am: cf50e348

Change-Id: I6012632c3690bd67edf3a8b71bde38b232d41d02
parents 6a105786 cf50e348
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -55,6 +55,11 @@ int trusty_keymaster_call(uint32_t cmd, void* in, uint32_t in_size, uint8_t* out


    size_t msg_size = in_size + sizeof(struct keymaster_message);
    size_t msg_size = in_size + sizeof(struct keymaster_message);
    struct keymaster_message* msg = reinterpret_cast<struct keymaster_message*>(malloc(msg_size));
    struct keymaster_message* msg = reinterpret_cast<struct keymaster_message*>(malloc(msg_size));
    if (!msg) {
        ALOGE("failed to allocate msg buffer\n");
        return -EINVAL;
    }

    msg->cmd = cmd;
    msg->cmd = cmd;
    memcpy(msg->payload, in, in_size);
    memcpy(msg->payload, in, in_size);