diff options
author | Campbell Barton <campbell@blender.org> | 2022-10-30 07:34:02 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-10-30 07:34:02 +0300 |
commit | d66f24cfe30d26e03863a78de9fd58bb3b65ed43 (patch) | |
tree | c626e7dd55f5c2ea3e72edb28224e5654f54bf55 /source/blender/blenkernel/intern/pointcache.c | |
parent | 5d77c3a6a5a27094342d942c5eb4db3c8ded1cd1 (diff) |
Fix potential buffer overflow with BLI_path_slash_ensure use
BLI_path_slash_ensure was appending to fixed sized buffers without
a size check.
Diffstat (limited to 'source/blender/blenkernel/intern/pointcache.c')
-rw-r--r-- | source/blender/blenkernel/intern/pointcache.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index ac98bed2cf0..bb9a0f458b9 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1317,7 +1317,7 @@ static int ptcache_path(PTCacheID *pid, char *dirname) BLI_path_abs(dirname, blendfilename); } - return BLI_path_slash_ensure(dirname); /* new strlen() */ + return BLI_path_slash_ensure(dirname, MAX_PTCACHE_FILE); /* new strlen() */ } if ((blendfile_path[0] != '\0') || lib) { char file[MAX_PTCACHE_PATH]; /* we don't want the dir, only the file */ @@ -1334,14 +1334,14 @@ static int ptcache_path(PTCacheID *pid, char *dirname) BLI_snprintf(dirname, MAX_PTCACHE_PATH, "//" PTCACHE_PATH "%s", file); BLI_path_abs(dirname, blendfilename); - return BLI_path_slash_ensure(dirname); /* new strlen() */ + return BLI_path_slash_ensure(dirname, MAX_PTCACHE_FILE); /* new strlen() */ } /* use the temp path. this is weak but better than not using point cache at all */ /* temporary directory is assumed to exist and ALWAYS has a trailing slash */ BLI_snprintf(dirname, MAX_PTCACHE_PATH, "%s" PTCACHE_PATH, BKE_tempdir_session()); - return BLI_path_slash_ensure(dirname); /* new strlen() */ + return BLI_path_slash_ensure(dirname, MAX_PTCACHE_FILE); /* new strlen() */ } static size_t ptcache_filepath_ext_append(PTCacheID *pid, |