* [PATCH] init: Do not segfault on big GIT_TEMPLATE_DIR environment variable
@ 2009-04-18 14:14 Frank Lichtenheld
0 siblings, 0 replies; only message in thread
From: Frank Lichtenheld @ 2009-04-18 14:14 UTC (permalink / raw)
To: gitster; +Cc: git, Frank Lichtenheld
From: Frank Lichtenheld <flichtenheld@astaro.com>
Signed-off-by: Frank Lichtenheld <flichtenheld@astaro.com>
---
builtin-init-db.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/builtin-init-db.c b/builtin-init-db.c
index 4e02b33..d1fa12a 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -122,8 +122,10 @@ static void copy_templates(const char *template_dir)
template_dir = system_path(DEFAULT_GIT_TEMPLATE_DIR);
if (!template_dir[0])
return;
+ template_len = strlen(template_dir);
+ if (PATH_MAX <= (template_len+strlen("/config")))
+ die("insanely long template path %s", template_dir);
strcpy(template_path, template_dir);
- template_len = strlen(template_path);
if (template_path[template_len-1] != '/') {
template_path[template_len++] = '/';
template_path[template_len] = 0;
--
1.6.2.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2009-04-18 14:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-18 14:14 [PATCH] init: Do not segfault on big GIT_TEMPLATE_DIR environment variable Frank Lichtenheld
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).