Fix stack buffer overflow in macOS mach_smi collector (#22553)
Artem Labazov committed
May 25, 2026 at 11:48 UTC
64ceb9c98fff1ed8dbef7dcebf8e5488df2bb417
1 file changed
+2
-2
src/collectors/macos.plugin/macos_mach_smi.c
+2
-2
@@ -88,10 +88,10 @@ int do_macos_mach_smi(int update_every, usec_t dt) {
88
89
if (likely(do_ram || do_swapio || do_pgfaults)) {
90
#if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060)
91
- count = sizeof(vm_statistics64_data_t);
91
+ count = HOST_VM_INFO64_COUNT;
92
kr = host_statistics64(host, HOST_VM_INFO64, (host_info64_t)&vm_statistics, &count);
93
#else
94
- count = sizeof(vm_statistics_data_t);
94
+ count = HOST_VM_INFO_COUNT;
95
kr = host_statistics(host, HOST_VM_INFO, (host_info_t)&vm_statistics, &count);
96
#endif
97
if (unlikely(kr != KERN_SUCCESS)) {