From: Junio C Hamano Date: Wed, 17 Dec 2008 20:37:48 +0000 (-0800) Subject: make_absolute_path(): check bounds when seeing an overlong symlink X-Git-Tag: v1.6.1-rc4~20^2~2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=737e31af7ae365d6251bb196e06d18afda9c98a8;p=git.git make_absolute_path(): check bounds when seeing an overlong symlink Signed-off-by: Junio C Hamano Acked-by: Linus Torvalds --- diff --git a/abspath.c b/abspath.c index 8194ce125..649f34f83 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;