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

Commit 58a1b328 authored by Edwin Wong's avatar Edwin Wong
Browse files

Check scopeId size in provideKeyResponse

Need to check scopeId size before access.

Bug: 144507096

Test: sts
ANDROID_BUILD_TOP= ./android-sts/tools/sts-tradefed run sts-engbuild-no-spl-lock -m StsHostTestCases --test android.security.sts.Poc19_11#testPocBug_144507096

Merged-In: I5d875f98e29c1115c156f7364c9c042426e17d7c
Change-Id: I5d875f98e29c1115c156f7364c9c042426e17d7c
(cherry picked from commit a9b9a30d)
(cherry picked from http://go/ag/10026240)
parent 4a56e5c5
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -356,6 +356,11 @@ Return<void> DrmPlugin::provideKeyResponse(

    Status status = Status::OK;
    bool isOfflineLicense = responseString.find(kOfflineLicense) != std::string::npos;
    if (scopeId.size() < kKeySetIdPrefix.size()) {
        android_errorWriteLog(0x534e4554, "144507096");
        _hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, hidl_vec<uint8_t>());
        return Void();
    }
    bool isRelease = (memcmp(scopeId.data(), kKeySetIdPrefix.data(), kKeySetIdPrefix.size()) == 0);
    if (isRelease) {
        keySetId.assign(scopeId.begin(), scopeId.end());