提交 d677db86 编写于 作者: A Andy Whitcroft 提交者: Junio C Hamano

ssh-upload: prevent buffer overrun

Prevent a client from overrunning the on stack ref buffer.
Signed-off-by: NAndy Whitcroft <apw@shadowen.org>
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 4083c2fc
......@@ -67,7 +67,7 @@ static int serve_ref(int fd_in, int fd_out)
int posn = 0;
signed char remote = 0;
do {
if (read(fd_in, ref + posn, 1) < 1)
if (posn >= PATH_MAX || read(fd_in, ref + posn, 1) < 1)
return -1;
posn++;
} while (ref[posn - 1]);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册