ssh-upload: prevent buffer overrun
Prevent a client from overrunning the on stack ref buffer. Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Andy Whitcroft committed
Jan 8, 2007 at 11:45 UTC
d677db86d9fa98b063846ed461312eb04fe23ba5
1 file changed
+1
-1
ssh-upload.c
+1
-1
@@ -67,7 +67,7 @@ static int serve_ref(int fd_in, int fd_out)
67
int posn = 0;
68
signed char remote = 0;
69
do {
70
- if (read(fd_in, ref + posn, 1) < 1)
70
+ if (posn >= PATH_MAX || read(fd_in, ref + posn, 1) < 1)
71
return -1;
72
posn++;
73
} while (ref[posn - 1]);