summaryrefslogtreecommitdiff
path: root/src/attrcache.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-11-01 20:14:34 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2021-11-09 15:17:18 +0000
commit91246ee5e0d8be8a15a669844f0893cd0f01c604 (patch)
tree34d4ee78572e4a02456d91072858dd5373c8bed7 /src/attrcache.c
parent1728e27c96a2e14328423554d3559166ebd1bab7 (diff)
downloadlibgit2-91246ee5e0d8be8a15a669844f0893cd0f01c604.tar.gz
path: use new length validation functions
Diffstat (limited to 'src/attrcache.c')
-rw-r--r--src/attrcache.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/attrcache.c b/src/attrcache.c
index 15c7fab48..b16d95c3c 100644
--- a/src/attrcache.c
+++ b/src/attrcache.c
@@ -12,6 +12,7 @@
#include "config.h"
#include "sysdir.h"
#include "ignore.h"
+#include "path.h"
GIT_INLINE(int) attr_cache_lock(git_attr_cache *cache)
{
@@ -43,6 +44,7 @@ int git_attr_cache__alloc_file_entry(
const char *path,
git_pool *pool)
{
+ git_str fullpath_str = GIT_STR_INIT;
size_t baselen = 0, pathlen = strlen(path);
size_t cachesize = sizeof(git_attr_file_entry) + pathlen + 1;
git_attr_file_entry *ce;
@@ -66,7 +68,10 @@ int git_attr_cache__alloc_file_entry(
}
memcpy(&ce->fullpath[baselen], path, pathlen);
- if (git_fs_path_validate_workdir_with_len(repo, ce->fullpath, pathlen + baselen) < 0)
+ fullpath_str.ptr = ce->fullpath;
+ fullpath_str.size = pathlen + baselen;
+
+ if (git_path_validate_str_length(repo, &fullpath_str) < 0)
return -1;
ce->path = &ce->fullpath[baselen];
@@ -173,7 +178,7 @@ static int attr_cache_lookup(
git_str *p = attr_session ? &attr_session->tmp : &path;
if (git_str_joinpath(p, source->base, source->filename) < 0 ||
- git_fs_path_validate_workdir_buf(repo, p) < 0)
+ git_path_validate_str_length(repo, p) < 0)
return -1;
filename = p->ptr;