Browse Source

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>
maint
Andy Whitcroft 18 years ago committed by Junio C Hamano
parent
commit
d677db86d9
  1. 2
      ssh-upload.c

2
ssh-upload.c

@ -67,7 +67,7 @@ static int serve_ref(int fd_in, int fd_out) @@ -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]);

Loading…
Cancel
Save