diff --git a/libwvdrmengine/cdm/core/src/crypto_session.cpp b/libwvdrmengine/cdm/core/src/crypto_session.cpp index f56a1764..f89cd39a 100644 --- a/libwvdrmengine/cdm/core/src/crypto_session.cpp +++ b/libwvdrmengine/cdm/core/src/crypto_session.cpp @@ -2445,6 +2445,17 @@ bool CryptoSession::GetBuildInformation(RequestedSecurityLevel security_level, return false; } info->resize(info_length); + // Some OEMCrypto implementations may include trailing null + // bytes in the output. Trim them here. + while (!info->empty() && info->back() == '\0') { + info->pop_back(); + } + if (info->empty()) { + LOGE("BuildInformation() returned corrupted data: length = %zu", + info_length); + return false; + } + return true; }