diff --git a/src/detection/cpu/cpu_windows.c b/src/detection/cpu/cpu_windows.c index 79ed7a660..d5c7f843f 100644 --- a/src/detection/cpu/cpu_windows.c +++ b/src/detection/cpu/cpu_windows.c @@ -102,12 +102,16 @@ const char* detectThermalTemp(double* result) if (pCounterData->dwDataSize == sizeof(int32_t)) { DWORD* pCounterIds = (DWORD*)(pMultiCounters + 1); + int32_t value = *(int32_t*)(pCounterData + 1); + if (value == 0) + return "Temperature data is zero"; + switch (pCounterIds[iCounter]) { case 0: // Temperature - *result = *(int32_t*)(pCounterData + 1) - 273; + *result = value - 273; break; case 3: // High Precision Temperature - *result = *(int32_t*)(pCounterData + 1) / 10.0 - 273; + *result = value / 10.0 - 273; break; } }