Commit b6dcc2ebc9691c037e4a4c0625a4e3da972d6f2f

Vicent Martí 2011-09-20T15:37:55

Merge pull request #414 from carlosmn/repo-discover-short repsitory: use better error code if path is too short for discover

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/src/repository.c b/src/repository.c
index bb7ef39..a39ccb6 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -558,8 +558,8 @@ int git_repository_discover(char *repository_path, size_t size, const char *star
 		}
 	}
 
-	if (size < (strlen(found_path) + 2) * sizeof(char)) {
-		return git__throw(GIT_EOVERFLOW, "The repository buffer is not long enough to handle the repository path `%s`", found_path);
+	if (size < strlen(found_path) + 2) {
+		return git__throw(GIT_ESHORTBUFFER, "The repository buffer is not long enough to handle the repository path `%s`", found_path);
 	}
 
 	git_path_join(repository_path, found_path, "");