[Bf-blender-cvs] [4a98e337857] master: Fix heap buffer overflow in tabs to spaces
Sergey Sharybin
noreply at git.blender.org
Wed May 8 14:37:09 CEST 2019
Commit: 4a98e3378574404615e643ed640ce84dc41e32be
Author: Sergey Sharybin
Date: Wed May 8 14:36:35 2019 +0200
Branches: master
https://developer.blender.org/rB4a98e3378574404615e643ed640ce84dc41e32be
Fix heap buffer overflow in tabs to spaces
Need to count string terminator.
===================================================================
M source/blender/editors/space_text/text_ops.c
===================================================================
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index d0809ec33fc..a3a438c3220 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -101,7 +101,7 @@ static char *buf_tabs_to_spaces(const char *in_buf, const int tab_size)
}
/* Allocate output before with extra space for expanded tabs. */
- const int out_size = strlen(in_buf) + num_tabs * (tab_size - 1);
+ const int out_size = strlen(in_buf) + num_tabs * (tab_size - 1) + 1;
char *out_buf = MEM_mallocN(out_size * sizeof(char), __func__);
/* Fill output buffer. */
More information about the Bf-blender-cvs
mailing list