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/blenlib/BLI_path_util.h | |
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/blenlib/BLI_path_util.h')
-rw-r--r-- | source/blender/blenlib/BLI_path_util.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index d4d2ddead71..9c661178322 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -218,7 +218,7 @@ const char *BLI_path_slash_rfind(const char *string) ATTR_NONNULL() ATTR_WARN_UN * Appends a slash to string if there isn't one there already. * Returns the new length of the string. */ -int BLI_path_slash_ensure(char *string) ATTR_NONNULL(); +int BLI_path_slash_ensure(char *string, size_t string_maxlen) ATTR_NONNULL(1); /** * Removes the last slash and everything after it to the end of string, if there is one. */ @@ -314,7 +314,7 @@ void BLI_path_normalize(const char *relabase, char *path) ATTR_NONNULL(2); * * \note Same as #BLI_path_normalize but adds a trailing slash. */ -void BLI_path_normalize_dir(const char *relabase, char *dir) ATTR_NONNULL(2); +void BLI_path_normalize_dir(const char *relabase, char *dir, size_t dir_maxlen) ATTR_NONNULL(2); /** * Make given name safe to be used in paths. |