Merge "Trim trailing zeros from build information." into vic-widevine-dev

This commit is contained in:
Alex Dale
2025-01-14 14:25:49 -08:00
committed by Android (Google) Code Review

View File

@@ -2541,6 +2541,17 @@ bool CryptoSession::GetBuildInformation(RequestedSecurityLevel security_level,
return false; return false;
} }
info->resize(info_length); 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; return true;
} }