Code

Merge branch 'maint-1.6.6' into maint-1.7.0
[git.git] / setup.c
diff --git a/setup.c b/setup.c
index 710e2f3008c79c08cdc507288881c9a58311283a..68605954b45435e5b98bcebd87cfcd74bc3d92d5 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -169,6 +169,8 @@ static int is_git_directory(const char *suspect)
        char path[PATH_MAX];
        size_t len = strlen(suspect);
 
+       if (PATH_MAX <= len + strlen("/objects"))
+               die("Too long path: %.*s", 60, suspect);
        strcpy(path, suspect);
        if (getenv(DB_ENVIRONMENT)) {
                if (access(getenv(DB_ENVIRONMENT), X_OK))
@@ -206,7 +208,7 @@ int is_inside_work_tree(void)
 }
 
 /*
- * set_work_tree() is only ever called if you set GIT_DIR explicitely.
+ * set_work_tree() is only ever called if you set GIT_DIR explicitly.
  * The old behaviour (which we retain here) is to set the work tree root
  * to the cwd, unless overridden by the config, the command line, or
  * GIT_WORK_TREE.