From 8332ab8173087562194e4306c6909863cce7cad7 Mon Sep 17 00:00:00 2001
From: Ken Raeburn <raeburn@mit.edu>
Date: Sat, 9 Nov 2002 01:35:21 +0000
Subject: [PATCH] * main.c (makeargv): Report an error if parsed arguments
 won't fit in margv array. * ftp_var.h (line, argbuf): Extend to 500 bytes.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14983 dc483132-0cff-0310-8789-dd5450dbe970
---
 src/appl/gssftp/ftp/ChangeLog | 6 ++++++
 src/appl/gssftp/ftp/ftp_var.h | 4 ++--
 src/appl/gssftp/ftp/main.c    | 9 ++++++++-
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/appl/gssftp/ftp/ChangeLog b/src/appl/gssftp/ftp/ChangeLog
index 1b7835320..385036d2b 100644
--- a/src/appl/gssftp/ftp/ChangeLog
+++ b/src/appl/gssftp/ftp/ChangeLog
@@ -1,3 +1,9 @@
+2002-11-08  Ken Raeburn  <raeburn@mit.edu>
+
+	* main.c (makeargv): Report an error if parsed arguments won't fit
+	in margv array.
+	* ftp_var.h (line, argbuf): Extend to 500 bytes.
+
 2002-08-29  Ken Raeburn  <raeburn@mit.edu>
 
 	* Makefile.in: Revert $(S)=>/ change, for Windows support.
diff --git a/src/appl/gssftp/ftp/ftp_var.h b/src/appl/gssftp/ftp/ftp_var.h
index 79928b3f3..4448448aa 100644
--- a/src/appl/gssftp/ftp/ftp_var.h
+++ b/src/appl/gssftp/ftp/ftp_var.h
@@ -131,9 +131,9 @@ extern struct	servent *sp;	/* service spec for tcp/ftp */
 #include <setjmp.h>
 extern jmp_buf	toplevel;	/* non-local goto stuff for cmd scanner */
 
-extern char	line[200];	/* input line buffer */
+extern char	line[500];	/* input line buffer */
 extern char	*stringbase;	/* current scan point in line buffer */
-extern char	argbuf[200];	/* argument storage buffer */
+extern char	argbuf[500];	/* argument storage buffer */
 extern char	*argbase;	/* current storage point in arg buffer */
 extern int	margc;		/* count of arguments on input line */
 extern char	*margv[20];	/* args parsed from input line */
diff --git a/src/appl/gssftp/ftp/main.c b/src/appl/gssftp/ftp/main.c
index 60171da55..8e4cfe5ef 100644
--- a/src/appl/gssftp/ftp/main.c
+++ b/src/appl/gssftp/ftp/main.c
@@ -430,8 +430,15 @@ void makeargv()
 	stringbase = line;		/* scan from first of buffer */
 	argbase = argbuf;		/* store from first of buffer */
 	slrflag = 0;
-	while ((*argp++ = slurpstring()))
+	while ((*argp++ = slurpstring())) {
 		margc++;
+		if (margc == sizeof(margv)/sizeof(margv[0])) {
+			printf("sorry, too many arguments in input line\n");
+			margc = 0;
+			margv[0] = 0;
+			return;
+		}
+	}
 }
 
 /*
-- 
2.26.2