[Bf-blender-cvs] [be11603dc22] master: Fix (unreported) buffer overflow in Cycles' system_cpu_brand_string helper.

Bastien Montagne noreply at git.blender.org
Wed Sep 16 14:47:23 CEST 2020


Commit: be11603dc224345a1b75e8cdf7b0c5396db0d94d
Author: Bastien Montagne
Date:   Wed Sep 16 14:37:03 2020 +0200
Branches: master
https://developer.blender.org/rBbe11603dc224345a1b75e8cdf7b0c5396db0d94d

Fix (unreported) buffer overflow in Cycles' system_cpu_brand_string helper.

Since this buffer is used as an array of 12 32bits integers, and C++
`string` expect a NULL-terminated C-string, we need an extra char to
ensure last one is always NULL.

See D8906. Found while investigating T80657.

===================================================================

M	intern/cycles/util/util_system.cpp

===================================================================

diff --git a/intern/cycles/util/util_system.cpp b/intern/cycles/util/util_system.cpp
index 6d32153209a..2c1716ce515 100644
--- a/intern/cycles/util/util_system.cpp
+++ b/intern/cycles/util/util_system.cpp
@@ -166,7 +166,7 @@ static void __cpuid(int data[4], int selector)
 
 string system_cpu_brand_string()
 {
-  char buf[48] = {0};
+  char buf[49] = {0};
   int result[4] = {0};
 
   __cpuid(result, 0x80000000);



More information about the Bf-blender-cvs mailing list