Fix heap-buffer-overflow detected by ASAN.
Bug: 34949125 Bug: 34606909 Test: Make sure Android boots when built with SANITIZE_TARGET='address' Change-Id: I9c004e806f2025098aa72228284b05affd2c2802
This commit is contained in:
parent
f31abeb973
commit
03fc2fedd7
|
@ -180,8 +180,13 @@ static enum match_type identical(LogBufferElement* elem,
|
|||
if (!avcr) return DIFFERENT;
|
||||
lenr -= avcr - msgr;
|
||||
if (lenl != lenr) return DIFFERENT;
|
||||
if (fastcmp<memcmp>(avcl + strlen(avc), avcr + strlen(avc), lenl))
|
||||
// TODO: After b/35468874 is addressed, revisit "lenl > strlen(avc)"
|
||||
// condition, it might become superflous.
|
||||
if (lenl > strlen(avc) &&
|
||||
fastcmp<memcmp>(avcl + strlen(avc), avcr + strlen(avc),
|
||||
lenl - strlen(avc))) {
|
||||
return DIFFERENT;
|
||||
}
|
||||
return SAME;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue