|
9 | 9 |
|
10 | 10 | #include "tree.h" |
11 | 11 | #include "index.h" |
| 12 | +#include "path.h" |
12 | 13 |
|
13 | 14 | #define GIT_ITERATOR_FIRST_ACCESS (1 << 15) |
14 | 15 | #define GIT_ITERATOR_HONOR_IGNORES (1 << 16) |
@@ -1279,7 +1280,7 @@ static int filesystem_iterator_entry_hash( |
1279 | 1280 | iter->base.repo, entry->path, GIT_OBJECT_BLOB, NULL); |
1280 | 1281 |
|
1281 | 1282 | if (!(error = git_str_joinpath(&fullpath, iter->root, entry->path)) && |
1282 | | - !(error = git_fs_path_validate_workdir_buf(iter->base.repo, &fullpath))) |
| 1283 | + !(error = git_path_validate_str_length(iter->base.repo, &fullpath))) |
1283 | 1284 | error = git_odb_hashfile(&entry->id, fullpath.ptr, GIT_OBJECT_BLOB); |
1284 | 1285 |
|
1285 | 1286 | git_str_dispose(&fullpath); |
@@ -1361,7 +1362,7 @@ static int filesystem_iterator_frame_push( |
1361 | 1362 | git_str_puts(&root, iter->root); |
1362 | 1363 |
|
1363 | 1364 | if (git_str_oom(&root) || |
1364 | | - git_fs_path_validate_workdir_buf(iter->base.repo, &root) < 0) { |
| 1365 | + git_path_validate_str_length(iter->base.repo, &root) < 0) { |
1365 | 1366 | error = -1; |
1366 | 1367 | goto done; |
1367 | 1368 | } |
@@ -1389,10 +1390,16 @@ static int filesystem_iterator_frame_push( |
1389 | 1390 |
|
1390 | 1391 | while ((error = git_fs_path_diriter_next(&diriter)) == 0) { |
1391 | 1392 | iterator_pathlist_search_t pathlist_match = ITERATOR_PATHLIST_FULL; |
| 1393 | + git_str path_str = GIT_STR_INIT; |
1392 | 1394 | bool dir_expected = false; |
1393 | 1395 |
|
1394 | | - if ((error = git_fs_path_diriter_fullpath(&path, &path_len, &diriter)) < 0 || |
1395 | | - (error = git_fs_path_validate_workdir_with_len(iter->base.repo, path, path_len)) < 0) |
| 1396 | + if ((error = git_fs_path_diriter_fullpath(&path, &path_len, &diriter)) < 0) |
| 1397 | + goto done; |
| 1398 | + |
| 1399 | + path_str.ptr = (char *)path; |
| 1400 | + path_str.size = path_len; |
| 1401 | + |
| 1402 | + if ((error = git_path_validate_str_length(iter->base.repo, &path_str)) < 0) |
1396 | 1403 | goto done; |
1397 | 1404 |
|
1398 | 1405 | GIT_ASSERT(path_len > iter->root_len); |
@@ -1565,7 +1572,7 @@ static int filesystem_iterator_is_dir( |
1565 | 1572 | } |
1566 | 1573 |
|
1567 | 1574 | if ((error = git_str_joinpath(&fullpath, iter->root, entry->path)) < 0 || |
1568 | | - (error = git_fs_path_validate_workdir_buf(iter->base.repo, &fullpath)) < 0 || |
| 1575 | + (error = git_path_validate_str_length(iter->base.repo, &fullpath)) < 0 || |
1569 | 1576 | (error = p_stat(fullpath.ptr, &st)) < 0) |
1570 | 1577 | goto done; |
1571 | 1578 |
|
|
0 commit comments