aboutsummaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorDavid Greenman <dg@FreeBSD.org>1998-04-27 10:51:26 +0000
committerDavid Greenman <dg@FreeBSD.org>1998-04-27 10:51:26 +0000
commitb81d7e37bbf1f4bf92281bcb00e9930f824646d8 (patch)
tree85e41a329c04470416745a0cb8728f2ec6a43282 /libexec
parent30bdeb1201498e5f3f76f8f36958b158972302b2 (diff)
downloadsrc-b81d7e37bbf1f4bf92281bcb00e9930f824646d8.tar.gz
src-b81d7e37bbf1f4bf92281bcb00e9930f824646d8.zip
Fixed a bug where if MAXUSRARGS amount of args were passed in, the argv[]
array would end up without the NULL pointer termination, causing the glob code to glob whatever garbage happend to follow on the stack.
Notes
Notes: svn path=/head/; revision=35474
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ftpd/popen.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libexec/ftpd/popen.c b/libexec/ftpd/popen.c
index 47534d525be7..4996c257ee2c 100644
--- a/libexec/ftpd/popen.c
+++ b/libexec/ftpd/popen.c
@@ -39,7 +39,7 @@
static char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 4/6/94";
#endif
static const char rcsid[] =
- "$Id: popen.c,v 1.9 1997/11/21 07:38:43 charnier Exp $";
+ "$Id: popen.c,v 1.10 1998/02/25 07:10:57 danny Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -94,9 +94,11 @@ ftpd_popen(program, type)
return (NULL);
/* break up string into pieces */
- for (argc = 0, cp = program; argc < MAXUSRARGS; cp = NULL)
+ for (argc = 0, cp = program; argc < MAXUSRARGS; cp = NULL) {
if (!(argv[argc++] = strtok(cp, " \t\n")))
break;
+ }
+ argv[argc - 1] = NULL;
/* glob each piece */
gargv[0] = argv[0];