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

Commit 03fc2fed authored by Evgenii Stepanov's avatar Evgenii Stepanov
Browse files

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
parent f31abeb9
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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;
}