diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-12-22 00:56:49 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-12-22 00:56:49 +0400 |
commit | 3b7aa6bb122000da96b00cb1fc823085b8e1f348 (patch) | |
tree | 47c33787dfee2a1cf6b639fb51bb6c22f291d45c /source/blender/blenlib | |
parent | c287a09b40cf9010c36363d4ee61f7a88c6bad7d (diff) |
patch [#29667] Fix for potential memory corruption in path_util.c
from Andrew Wiggin (ender79)
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index e79d850caa5..9adb39f09ef 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -317,7 +317,7 @@ void BLI_uniquename(ListBase *list, void *vlink, const char defname[], char deli void BLI_cleanup_path(const char *relabase, char *dir) { - short a; + ptrdiff_t a; char *start, *eind; if (relabase) { BLI_path_abs(dir, relabase); @@ -1416,7 +1416,7 @@ int BLI_replace_extension(char *path, size_t maxlen, const char *ext) { size_t path_len= strlen(path); size_t ext_len= strlen(ext); - size_t a; + ssize_t a; for(a= path_len - 1; a >= 0; a--) { if (ELEM3(path[a], '.', '/', '\\')) { @@ -1424,7 +1424,7 @@ int BLI_replace_extension(char *path, size_t maxlen, const char *ext) } } - if (path[a] != '.') { + if ((a < 0) || (path[a] != '.')) { a= path_len; } @@ -1440,7 +1440,7 @@ int BLI_ensure_extension(char *path, size_t maxlen, const char *ext) { size_t path_len= strlen(path); size_t ext_len= strlen(ext); - size_t a; + ssize_t a; /* first check the extension is alread there */ if ( (ext_len <= path_len) && |