[Bf-blender-cvs] [fa2ef64d961] master: Fix (unreported) buffer overflow in BLI_system_cpu_brand_string helper.

Bastien Montagne noreply at git.blender.org
Wed Sep 16 15:04:28 CEST 2020


Commit: fa2ef64d961959e46d35ff11d50cfc8f7bdf484a
Author: Bastien Montagne
Date:   Wed Sep 16 15:02:02 2020 +0200
Branches: master
https://developer.blender.org/rBfa2ef64d961959e46d35ff11d50cfc8f7bdf484a

Fix (unreported) buffer overflow in BLI_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. Thanks to @brecht for noting this one too.

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

M	source/blender/blenlib/intern/system.c

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

diff --git a/source/blender/blenlib/intern/system.c b/source/blender/blenlib/intern/system.c
index e3572b7f05e..8e3d489fbb3 100644
--- a/source/blender/blenlib/intern/system.c
+++ b/source/blender/blenlib/intern/system.c
@@ -135,7 +135,7 @@ static void __cpuid(
 
 char *BLI_cpu_brand_string(void)
 {
-  char buf[48] = {0};
+  char buf[49] = {0};
   int result[4] = {0};
   __cpuid(result, 0x80000000);
   if (result[0] >= (int)0x80000004) {



More information about the Bf-blender-cvs mailing list