summaryrefslogtreecommitdiff
path: root/setup.c
diff options
context:
space:
mode:
authorMatthias Lederhofer <matled@gmx.net>2007-03-11 02:35:00 +0100
committerJunio C Hamano <junkio@cox.net>2007-03-10 21:47:45 -0800
commit96a5702409e193616ad7e56700dd6051ad324654 (patch)
tree1b5f417bd9f12e6b951036469c876cdc535f37c5 /setup.c
parent8bb2b516d56722776255faaccc0b1d63e444a93e (diff)
downloadgit-96a5702409e193616ad7e56700dd6051ad324654.tar.gz
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>
Diffstat (limited to 'setup.c')
-rw-r--r--setup.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/setup.c b/setup.c
index e9d3f5aab6..76e5e693cc 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);