[Beignet] [PATCH 1/2] fix global variable out of boundary writing in libocl.

xionghu.luo at intel.com xionghu.luo at intel.com
Thu Jun 11 18:10:00 PDT 2015


From: Luo Xionghu <xionghu.luo at intel.com>

need minus one when fill '\0' to sizeof char type array.

Signed-off-by: Luo Xionghu <xionghu.luo at intel.com>
---
 src/cl_extensions.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cl_extensions.c b/src/cl_extensions.c
index adcf82e..6b82b96 100644
--- a/src/cl_extensions.c
+++ b/src/cl_extensions.c
@@ -69,7 +69,7 @@ process_extension_str(cl_extensions_t *extensions)
   int str_offset = 0;
   int id;
 
-  extensions->ext_str[str_max] = '\0';
+  extensions->ext_str[str_max-1] = '\0';
 
   for(id = 0; id < cl_khr_extension_id_max; id++)
   {
-- 
1.9.1



More information about the Beignet mailing list