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

Commit 5351e4b3 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

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

Change-Id: Ibf1deab8c240dec43ba98f097075ea4f691c18aa
parents 82ddf01e d8c535a2
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -466,16 +466,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