[PATCH 2/2] Do not accept NUL in the path in .git file
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
setup.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/setup.c b/setup.c
index 2c51a9a..c1995b7 100644
--- a/setup.c
+++ b/setup.c
@@ -436,6 +436,8 @@ const char *read_gitfile_gently(const char *path)
if (len < 9)
die("No path in gitfile: %s", path);
buf[len] = '\0';
+ if (strlen(buf) < len)
+ die("invalid gitfile format: %s", path);
dir = buf + 8;
if (!is_absolute_path(dir) && (slash = strrchr(path, '/'))) {
--
1.7.4.74.g639db