summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ssh-upload.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ssh-upload.c b/ssh-upload.c
index 0b52ae15cb..901e0366df 100644
--- a/ssh-upload.c
+++ b/ssh-upload.c
@@ -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]);