mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-02-11 13:35:19 +00:00
The tpm_version tool can sometimes print a null value as part of the TPM major version if the major version is less than 4 characters. These nulls are now removed before printing.
This commit is contained in:
parent
d26a3da5ea
commit
4beb1d2bac
@ -114,6 +114,9 @@ class SapiContext {
|
|||||||
string reversedStringValue(UINT32 value) {
|
string reversedStringValue(UINT32 value) {
|
||||||
string stringValue(sizeof value, 0);
|
string stringValue(sizeof value, 0);
|
||||||
std::memcpy(&stringValue[0], &value, stringValue.size()); // copy bytes in
|
std::memcpy(&stringValue[0], &value, stringValue.size()); // copy bytes in
|
||||||
|
// get rid of all contained null values
|
||||||
|
stringValue.erase(std::remove(stringValue.begin(), stringValue.end(), '\0'),
|
||||||
|
stringValue.end());
|
||||||
std::reverse(stringValue.begin(), stringValue.end()); // reverse the bytes
|
std::reverse(stringValue.begin(), stringValue.end()); // reverse the bytes
|
||||||
return stringValue;
|
return stringValue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user