Commit 2da72fb21c1719b34a312dba3ebb7691032cfaa9

yorah 2013-06-14T12:10:13

fileops: fix invalid read

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/fileops.c b/src/fileops.c
index 02f48e1..ae240fc 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -320,7 +320,7 @@ int git_futils_mkdir(
 	min_root_len = git_path_root(make_path.ptr);
 	if (root < min_root_len)
 		root = min_root_len;
-	while (make_path.ptr[root] == '/')
+	while (root >= 0 && make_path.ptr[root] == '/')
 		++root;
 
 	/* clip root to make_path length */