diff options
author | Bastien Montagne <bastien@blender.org> | 2020-10-26 18:31:11 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-10-26 19:22:34 +0300 |
commit | 501854e4ee0a7ad5f1f0274be8fae76e16e604ec (patch) | |
tree | 80841d06927cabe535fae5b588110f55740e0f34 /source/blender/blenlib/intern/path_util.c | |
parent | 253ae3d3f0acbf8455f085abed59f07c23e387a0 (diff) |
Fix T81421: "Saving As..." a blend file with a Script node file path filled with 1023 symbols crashes Blender.
Usual lack of protection against buffer overflows when manipulating
strings.
Also add some basic tests for `BLI_path_rel`.
Diffstat (limited to 'source/blender/blenlib/intern/path_util.c')
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index f3afef80c3e..758feef6093 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -639,7 +639,7 @@ void BLI_path_rel(char *file, const char *relfile) } /* don't copy the slash at the beginning */ - r += BLI_strcpy_rlen(r, q + 1); + r += BLI_strncpy_rlen(r, q + 1, FILE_MAX - (r - res)); #ifdef WIN32 BLI_str_replace_char(res + 2, '/', '\\'); |