diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-05-08 15:36:35 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-05-08 15:37:05 +0300 |
commit | 4a98e3378574404615e643ed640ce84dc41e32be (patch) | |
tree | 034dc76b944e1fbf8d2f47e7905af7d75a72bcd0 | |
parent | c79fc710b3f97e5bcf8db59fc358d430617e08c9 (diff) |
Fix heap buffer overflow in tabs to spaces
Need to count string terminator.
-rw-r--r-- | source/blender/editors/space_text/text_ops.c | 2 |
1 files changed, 1 insertions, 1 deletions
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. */ |