From 737e31af7ae365d6251bb196e06d18afda9c98a8 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 17 Dec 2008 12:37:48 -0800 Subject: make_absolute_path(): check bounds when seeing an overlong symlink Signed-off-by: Junio C Hamano Acked-by: Linus Torvalds --- abspath.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'abspath.c') diff --git a/abspath.c b/abspath.c index 8194ce1256..649f34f833 100644 --- a/abspath.c +++ b/abspath.c @@ -64,6 +64,8 @@ const char *make_absolute_path(const char *path) len = readlink(buf, next_buf, PATH_MAX); if (len < 0) die ("Invalid symlink: %s", buf); + if (PATH_MAX <= len) + die("symbolic link too long: %s", buf); next_buf[len] = '\0'; buf = next_buf; buf_index = 1 - buf_index; -- cgit v1.2.3