Skip to content

Commit 737e31a

Browse files
committed
make_absolute_path(): check bounds when seeing an overlong symlink
Signed-off-by: Junio C Hamano <[email protected]> Acked-by: Linus Torvalds <[email protected]>
1 parent dfab6aa commit 737e31a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

abspath.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ const char *make_absolute_path(const char *path)
6464
len = readlink(buf, next_buf, PATH_MAX);
6565
if (len < 0)
6666
die ("Invalid symlink: %s", buf);
67+
if (PATH_MAX <= len)
68+
die("symbolic link too long: %s", buf);
6769
next_buf[len] = '\0';
6870
buf = next_buf;
6971
buf_index = 1 - buf_index;

0 commit comments

Comments
 (0)