Commit f46e622636c5196829329f7bcf2226b36e61f7ed

nulltoken 2012-01-04T21:15:12

Fix Windows specific off-by-one error The value returned by MultiByteToWideChar includes the NULL termination character.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/fileops.c b/src/fileops.c
index 5eb7bf6..48bd351 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -486,7 +486,7 @@ static int win32_find_system_file(git_buf *path, const char *filename)
 		filename++;
 
 	if (gitwin_append_utf16(file_utf16 + root->len - 1, filename, len + 1) !=
-		(int)len) {
+		(int)len + 1) {
 		error = git__throw(GIT_EOSERR, "Failed to build file path");
 		goto cleanup;
 	}