From 96a5702409e193616ad7e56700dd6051ad324654 Mon Sep 17 00:00:00 2001 From: Matthias Lederhofer Date: Sun, 11 Mar 2007 02:35:00 +0100 Subject: [PATCH] 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 Signed-off-by: Junio C Hamano --- setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.c b/setup.c index e9d3f5aab..76e5e693c 100644 --- a/setup.c +++ b/setup.c @@ -216,7 +216,7 @@ const char *setup_git_directory_gently(int *nongit_ok) die("Not a git repository: '%s'", gitdirenv); } - if (!getcwd(cwd, sizeof(cwd)) || cwd[0] != '/') + if (!getcwd(cwd, sizeof(cwd)-1) || cwd[0] != '/') die("Unable to read current working directory"); offset = len = strlen(cwd); -- 2.30.2