TIF: Check the CEC message length before copying the data

Bug: 25768736
Change-Id: Ife46891e785fe816c0ee6ba65bd57512366ce84d
This commit is contained in:
Jae Seo
2016-02-12 00:12:36 -08:00
parent f61a847881
commit d0efcbbbb5

View File

@@ -330,7 +330,7 @@ static jint nativeSendCecCommand(JNIEnv* env, jclass clazz, jlong controllerPtr,
jsize len = env->GetArrayLength(body);
message.length = MIN(len, CEC_MESSAGE_BODY_MAX_LENGTH);
ScopedByteArrayRO bodyPtr(env, body);
std::memcpy(message.body, bodyPtr.get(), len);
std::memcpy(message.body, bodyPtr.get(), message.length);
HdmiCecController* controller =
reinterpret_cast<HdmiCecController*>(controllerPtr);