[Bf-blender-cvs] [1b909c726bd] blender-v2.93-release: Fix build warning

Richard Antalik noreply at git.blender.org
Tue May 18 16:16:49 CEST 2021


Commit: 1b909c726bdb76b8e9847a37339ac023bd26e580
Author: Richard Antalik
Date:   Tue May 18 16:15:08 2021 +0200
Branches: blender-v2.93-release
https://developer.blender.org/rB1b909c726bdb76b8e9847a37339ac023bd26e580

Fix build warning

Value of the size argument in `strncat` is too large, might lead to a
buffer overflow.

Change the argument to be the free space in the destination buffer
minus the terminating null byte.

Introduced in 5368859a669d

Reviewed By: Sergey

Differential Revision: https://developer.blender.org/D11289

===================================================================

M	source/blender/sequencer/intern/image_cache.c

===================================================================

diff --git a/source/blender/sequencer/intern/image_cache.c b/source/blender/sequencer/intern/image_cache.c
index 7b873d5c66e..a0c95c1c197 100644
--- a/source/blender/sequencer/intern/image_cache.c
+++ b/source/blender/sequencer/intern/image_cache.c
@@ -361,7 +361,7 @@ static void seq_disk_cache_get_project_dir(SeqDiskCache *disk_cache, char *path,
   BLI_split_file_part(BKE_main_blendfile_path(disk_cache->bmain), cache_dir, sizeof(cache_dir));
   /* Use suffix, so that the cache directory name does not conflict with the bmain's blend file. */
   const char *suffix = "_seq_cache";
-  strncat(cache_dir, suffix, sizeof(cache_dir) - strlen(cache_dir));
+  strncat(cache_dir, suffix, sizeof(cache_dir) - strlen(cache_dir) - 1);
   BLI_strncpy(path, seq_disk_cache_base_dir(), path_len);
   BLI_path_append(path, path_len, cache_dir);
 }



More information about the Bf-blender-cvs mailing list