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

Commit 591b0965 authored by Evgenii Stepanov's avatar Evgenii Stepanov Committed by android-build-merger
Browse files

Merge "Fix heap-buffer-overflow detected by ASAN."

am: 3d028f14

Change-Id: Ia3c137490fae9da00f73dedd414ba2b8cd04a975
parents 938f8083 3d028f14
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -180,8 +180,13 @@ static enum match_type identical(LogBufferElement* elem,
    if (!avcr) return DIFFERENT;
    if (!avcr) return DIFFERENT;
    lenr -= avcr - msgr;
    lenr -= avcr - msgr;
    if (lenl != lenr) return DIFFERENT;
    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 DIFFERENT;
    }
    return SAME;
    return SAME;
}
}