зеркало из https://github.com/microsoft/git.git
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:
Родитель
dfab6aaecf
Коммит
737e31af7a
|
@ -64,6 +64,8 @@ const char *make_absolute_path(const char *path)
|
||||||
len = readlink(buf, next_buf, PATH_MAX);
|
len = readlink(buf, next_buf, PATH_MAX);
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
die ("Invalid symlink: %s", buf);
|
die ("Invalid symlink: %s", buf);
|
||||||
|
if (PATH_MAX <= len)
|
||||||
|
die("symbolic link too long: %s", buf);
|
||||||
next_buf[len] = '\0';
|
next_buf[len] = '\0';
|
||||||
buf = next_buf;
|
buf = next_buf;
|
||||||
buf_index = 1 - buf_index;
|
buf_index = 1 - buf_index;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче