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

Commit cf50e348 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

Change-Id: I039c5cccf74a1ad878ea7752918ed6d5b40552ea
parents 6b0abb1f a3e48767
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);