Commit 52d0065f authored by Kenji Bungo's avatar Kenji Bungo
Browse files

Prevent strlen reading past buffer due to unexpected file format. (e.g....

Prevent strlen reading past buffer due to unexpected file format. (e.g. decrypted file not removed). Consequently prevents use of old pack tool. Both cause ignore of update.
parent d10639e9
......@@ -188,6 +188,10 @@ static jstring android_UpdateService_getImageProductName(JNIEnv *env, jclass cla
{
offset = *(unsigned int*)(buf+0x21);
}
else{
LOGE("Image uses old packtool or is a bad format.");
goto EXIT;
}
/* �Ӿ����ļ���ȡ ���õIJ�Ʒ���. */
if ( read_bytes_from_file(path, offset+POSITION_OF_PRODUCT_NAME, sizeof(name), name) != 0 )
......@@ -247,6 +251,10 @@ static jstring android_UpdateService_getImageVersion(JNIEnv *env, jclass clazz,
{
offset = *(unsigned int*)(buf+0x21);
}
else{
LOGE("Image uses old packtool or is a bad format.");
goto EXIT;
}
/* �Ӿ����ļ���ȡ �汾��Ϣ. */
if ( read_bytes_from_file(path, offset+POSITION_OF_VERSION_INFO, sizeof(version_binary), version_binary) != 0 )
......
......@@ -366,6 +366,11 @@ public class RKUpdateService extends Service {
}
imageFileVersion = getImageVersion(path);
if(imageFileVersion==null)
{
LOG("WorkHandler::handleMessage() : not a valid rkimage !!");
return;
}
LOG("WorkHandler::handleMessage() : Find a VALID image file : '" + path
+ "'. imageFileVersion is '" + imageFileVersion);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment