Commit dcb7447cba581da6143ccc7634badba14083c4ad

Paul Betts 2011-12-14T11:15:19

Merge pull request #512 from nulltoken/fix/mktemp-segfault Prevent segfaulting on Windows when building a temporary filename

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c
index e406a8f..0001654 100644
--- a/src/win32/posix_w32.c
+++ b/src/win32/posix_w32.c
@@ -365,7 +365,7 @@ extern int p_creat(const char *path, mode_t mode);
 int p_mkstemp(char *tmp_path)
 {
 #if defined(_MSC_VER)
-	if (_mktemp_s(tmp_path, GIT_PATH_MAX) != 0)
+	if (_mktemp_s(tmp_path, strlen(tmp_path) + 1) != 0)
 		return GIT_EOSERR;
 #else
 	if (_mktemp(tmp_path) == NULL)