Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2020-10-26 18:31:11 +0300
committerJeroen Bakker <jeroen@blender.org>2020-10-28 11:26:59 +0300
commit8926b09fa9a065912aa0237015c6085200834cd3 (patch)
tree4205bd10c216732541d8ba35fbe401fb593d2bea /source
parentc2535dff902641ab331301fb8edc788c2c132a34 (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')
-rw-r--r--source/blender/blenlib/intern/path_util.c2
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 2f51b66725b..80ed7776c06 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -641,7 +641,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, '/', '\\');