[automerger] Check for null-terminator in ResStringPool::string8At am: 5ec65ae909 am: c3d7250b99 am: e2417e6682
Change-Id: Ief72a1c4868ab7433e4d3d4d99cbdc30954d6695
This commit is contained in:
@@ -805,7 +805,13 @@ const char* ResStringPool::string8At(size_t idx, size_t* outLen) const
|
||||
*outLen = decodeLength(&str);
|
||||
size_t encLen = decodeLength(&str);
|
||||
if ((uint32_t)(str+encLen-strings) < mStringPoolSize) {
|
||||
return (const char*)str;
|
||||
// Reject malformed (non null-terminated) strings
|
||||
if (str[encLen] != 0x00) {
|
||||
ALOGW("Bad string block: string #%d is not null-terminated",
|
||||
(int)idx);
|
||||
return NULL;
|
||||
}
|
||||
return (const char*)str;
|
||||
} else {
|
||||
ALOGW("Bad string block: string #%d extends to %d, past end at %d\n",
|
||||
(int)idx, (int)(str+encLen-strings), (int)mStringPoolSize);
|
||||
|
||||
Reference in New Issue
Block a user