Skip to content

Commit

Permalink
make_absolute_path(): check bounds when seeing an overlong symlink
Browse files Browse the repository at this point in the history
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Junio C Hamano committed Dec 17, 2008
1 parent dfab6aa commit 737e31a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions abspath.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 737e31a

Please sign in to comment.