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

Commit 9602e3d3 authored by Xin Li's avatar Xin Li Committed by Gerrit Code Review
Browse files

Merge "DO NOT MERGE - Merge RP1A.201005.006"

parents 6d452d7e 7fd5f8d2
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -309,8 +309,14 @@ status_t String8::appendFormatV(const char* fmt, va_list args)
    n = vsnprintf(nullptr, 0, fmt, tmp_args);
    va_end(tmp_args);

    if (n != 0) {
    if (n < 0) return UNKNOWN_ERROR;

    if (n > 0) {
        size_t oldLength = length();
        if ((size_t)n > SIZE_MAX - 1 ||
            oldLength > SIZE_MAX - (size_t)n - 1) {
            return NO_MEMORY;
        }
        char* buf = lockBuffer(oldLength + n);
        if (buf) {
            vsnprintf(buf + oldLength, n + 1, fmt, args);