Skip to content

Commit

Permalink
fix: x64 memory collection panic
Browse files Browse the repository at this point in the history
Don't read strings that are not there from virtual SMBIOS
  • Loading branch information
kichik committed Jan 18, 2022
1 parent 5ed55c0 commit 0205c62
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion providers/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ func readMemoryDevice(record *smbios.Structure) MemoryDevice {
binary.Read(recordBytes, binary.LittleEndian, &memDevice.MaximumVoltage)
binary.Read(recordBytes, binary.LittleEndian, &memDevice.ConfiguredVoltage)

memDevice.Location = record.Strings[0]
if len(record.Strings) >= 1 {
memDevice.Location = record.Strings[0]
}

return memDevice
}

0 comments on commit 0205c62

Please sign in to comment.