Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GetMemorySize for Windows memory_devices table #7711

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 1 addition & 7 deletions osquery/tables/system/windows/smbios_tables.cpp
Expand Up @@ -84,13 +84,7 @@ std::string getMemoryTypeDetails(int id) {
}

uint32_t getMemorySize(const std::wstring& capacityWStr) {
int base = 10;
if (capacityWStr.size() < 2) {
wchar_t second_char = capacityWStr[1];
if (second_char == wchar_t('x') || second_char == wchar_t('X')) {
base = 16;
}
}
int base = 0; // Passing a base of 0 auto-detects the base.
uint64_t capacityBytes = std::wcstoull(capacityWStr.data(), nullptr, base);
// Capacity row from WMI is in bytes, convert to Megabytes which means the
// column can remain an INTEGER.
Expand Down