From: Matthias Lederhofer Date: Sun, 11 Mar 2007 01:35:00 +0000 (+0100) Subject: setup_git_directory_gently: fix off-by-one error X-Git-Tag: v1.5.0.4~11 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=96a5702409e193616ad7e56700dd6051ad324654;p=git.git 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 --- 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);