Commit 4470e48a7dc5447952188db2bea7e6f141082343

Edward Thomson 2021-04-04T14:24:35

workdir: validate working directory entry path length

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/src/filter.c b/src/filter.c
index ccabdcd..b82becd 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -972,8 +972,10 @@ int git_filter_list_stream_file(
 
 	if ((error = stream_list_init(
 			&stream_start, &filter_streams, filters, target)) < 0 ||
-		(error = git_path_join_unrooted(&abspath, path, base, NULL)) < 0)
+	    (error = git_path_join_unrooted(&abspath, path, base, NULL)) < 0 ||
+	    (error = git_path_validate_workdir_buf(repo, &abspath)) < 0)
 		goto done;
+
 	initialized = 1;
 
 	if ((fd = git_futils_open_ro(abspath.ptr)) < 0) {