mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-01-30 08:04:05 +00:00
[#135] Fix DeviceInfoCollector's handling of C-Style Strings
This commit is contained in:
parent
3bebec1154
commit
d26a3da5ea
@ -293,10 +293,15 @@ public class DeviceInfoCollector extends AbstractCollector {
|
|||||||
&& tokens[VERSION_INDEX].equals("Version")) {
|
&& tokens[VERSION_INDEX].equals("Version")) {
|
||||||
String[] versionTokens = tokens[VERSION_TOKEN_INDEX].split("\\.");
|
String[] versionTokens = tokens[VERSION_TOKEN_INDEX].split("\\.");
|
||||||
if (versionTokens.length == VERSION_TOKEN_LENGTH) {
|
if (versionTokens.length == VERSION_TOKEN_LENGTH) {
|
||||||
tpmVersionMajor = Short.parseShort(versionTokens[TPM_MAJOR_INDEX]);
|
// Trim version tokens to avoid C-style strings w/ null characters
|
||||||
tpmVersionMinor = Short.parseShort(versionTokens[TPM_MINOR_INDEX]);
|
tpmVersionMajor = Short.parseShort(
|
||||||
tpmVersionRevMajor = Short.parseShort(versionTokens[TPM_REV_MAJOR_INDEX]);
|
versionTokens[TPM_MAJOR_INDEX].trim());
|
||||||
tpmVersionRevMinor = Short.parseShort(versionTokens[TPM_REV_MINOR_INDEX]);
|
tpmVersionMinor = Short.parseShort(
|
||||||
|
versionTokens[TPM_MINOR_INDEX].trim());
|
||||||
|
tpmVersionRevMajor = Short.parseShort(
|
||||||
|
versionTokens[TPM_REV_MAJOR_INDEX].trim());
|
||||||
|
tpmVersionRevMinor = Short.parseShort(
|
||||||
|
versionTokens[TPM_REV_MINOR_INDEX].trim());
|
||||||
LOGGER.debug("Found TPM version {}.{}.{}.{}",
|
LOGGER.debug("Found TPM version {}.{}.{}.{}",
|
||||||
tpmVersionMajor, tpmVersionMinor,
|
tpmVersionMajor, tpmVersionMinor,
|
||||||
tpmVersionRevMajor, tpmVersionRevMinor);
|
tpmVersionRevMajor, tpmVersionRevMinor);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user