1
0
mirror of https://github.com/git/git.git synced 2024-09-25 13:21:31 +02:00

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>
This commit is contained in:
Junio C Hamano 2008-12-17 12:37:48 -08:00
parent dfab6aaecf
commit 737e31af7a

View File

@ -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;