make_absolute_path(): check bounds when seeing an overlong symlink
Signed-off-by: Junio C Hamano <gitster@pobox.com> Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Junio C Hamano committed
Dec 17, 2008 at 12:37 UTC
737e31af7ae365d6251bb196e06d18afda9c98a8
1 file changed
+2
abspath.c
+2
@@ -64,6 +64,8 @@ const char *make_absolute_path(const char *path)
64
len = readlink(buf, next_buf, PATH_MAX);
65
if (len < 0)
66
die ("Invalid symlink: %s", buf);
67
+ if (PATH_MAX <= len)
68
+ die("symbolic link too long: %s", buf);
69
next_buf[len] = '\0';
70
buf = next_buf;
71
buf_index = 1 - buf_index;