setup_git_directory_gently: fix off-by-one error
don't tell getcwd that the buffer has one spare byte for an extra / Signed-off-by: Matthias Lederhofer <matled@gmx.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
Matthias Lederhofer committed
Mar 11, 2007 at 02:35 UTC
96a5702409e193616ad7e56700dd6051ad324654
1 file changed
+1
-1
setup.c
+1
-1
@@ -216,7 +216,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
216
die("Not a git repository: '%s'", gitdirenv);
217
}
218
219
- if (!getcwd(cwd, sizeof(cwd)) || cwd[0] != '/')
219
+ if (!getcwd(cwd, sizeof(cwd)-1) || cwd[0] != '/')
220
die("Unable to read current working directory");
221
222
offset = len = strlen(cwd);