From 914d92dc3a2f3d0f3065abf52ba3da557910ee76 Mon Sep 17 00:00:00 2001 From: Benny Baumann Date: Fri, 28 Jul 2023 13:01:39 +0200 Subject: Avoid VLA on Darwin when reading CPU brand --- darwin/PlatformHelpers.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'darwin') diff --git a/darwin/PlatformHelpers.c b/darwin/PlatformHelpers.c index 97f0741a..a4ea82be 100644 --- a/darwin/PlatformHelpers.c +++ b/darwin/PlatformHelpers.c @@ -103,9 +103,8 @@ double Platform_calculateNanosecondsPerMachTick(void) { * the "Apple M1" chip specifically when running under Rosetta 2. */ - size_t cpuBrandStringSize = 1024; - char cpuBrandString[cpuBrandStringSize]; - Platform_getCPUBrandString(cpuBrandString, cpuBrandStringSize); + char cpuBrandString[1024] = ""; + Platform_getCPUBrandString(cpuBrandString, sizeof(cpuBrandString)); bool isRunningUnderRosetta2 = Platform_isRunningTranslated(); -- cgit v1.2.3