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

Commit c394a550 authored by Ray Essick's avatar Ray Essick Committed by Automerger Merge Worker
Browse files

Merge "Better buffer-overrun prevention" into rvc-dev am: d8c535a2 am: 5351e4b3 am: 2c09c9f2

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/av/+/16230693

Change-Id: Ia8721e47cd9f389706a77537e4403b93f12f6465
parents 09ed0a50 2c09c9f2
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -469,16 +469,15 @@ protected:
    template <> // static
    status_t extract(std::string *val, const char **bufferpptr, const char *bufferptrmax) {
        const char *ptr = *bufferpptr;
        while (*ptr != 0) {
        do {
            if (ptr >= bufferptrmax) {
                ALOGE("%s: buffer exceeded", __func__);
                return BAD_VALUE;
            }
            ++ptr;
        }
        const size_t size = (ptr - *bufferpptr) + 1;
        } while (*ptr++ != 0);
        // ptr is terminator+1, == bufferptrmax if we finished entire buffer
        *val = *bufferpptr;
        *bufferpptr += size;
        *bufferpptr = ptr;
        return NO_ERROR;
    }
    template <> // static