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

Commit 7df6349a authored by The Android Open Source Project's avatar The Android Open Source Project
Browse files

merge from open-source master

Change-Id: I698b3c16bdef8751cc857b00f815cb2f95465431
parents b51cb880 fd7ebb36
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -753,6 +753,16 @@ char *android_log_formatLogLine (
            suffixLen = 1;
            break;
    }
    /* snprintf has a weird return value.   It returns what would have been
     * written given a large enough buffer.  In the case that the prefix is
     * longer then our buffer(128), it messes up the calculations below
     * possibly causing heap corruption.  To avoid this we double check and
     * set the length at the maximum (size minus null byte)
     */
    if(prefixLen >= sizeof(prefixBuf))
        prefixLen = sizeof(prefixBuf) - 1;
    if(suffixLen >= sizeof(suffixBuf))
        suffixLen = sizeof(suffixBuf) - 1;

    /* the following code is tragically unreadable */