From 85a2280c861122da70a26da0c664bc1c4615efcd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 11 Oct 2011 05:21:24 +0000 Subject: [PATCH] fix for crash in BLI_join_dirfile() when the dir is longer then the target string. starting blender in a dir longer then 240 chars would crash. --- source/blender/blenlib/intern/path_util.c | 26 ++++++----------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 8adede3337c..b206e275d9a 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -1433,16 +1433,16 @@ void BLI_split_dirfile(const char *string, char *dir, char *file) void BLI_join_dirfile(char *string, const size_t maxlen, const char *dir, const char *file) { int sl_dir; - + if(string != dir) /* compare pointers */ - BLI_strncpy(string, dir, maxlen); + BLI_strncpy(string, dir, maxlen -(file ? 1 : 0)); if (!file) return; - + sl_dir= BLI_add_slash(string); - if (sl_dir