summaryrefslogtreecommitdiffstats
path: root/libexec/ftpd
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1998-04-27 10:51:26 +0000
committerdg <dg@FreeBSD.org>1998-04-27 10:51:26 +0000
commit1c811baafb24bd03555fb376d826af31717a198d (patch)
tree11c4b79e0e08fe3ae8ec821e1d9ab1f712689050 /libexec/ftpd
parente823d4669619673df5b4eeb83f14addeeb5b29e7 (diff)
downloadFreeBSD-src-1c811baafb24bd03555fb376d826af31717a198d.zip
FreeBSD-src-1c811baafb24bd03555fb376d826af31717a198d.tar.gz
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.
Diffstat (limited to 'libexec/ftpd')
-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 47534d5..4996c25 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];
OpenPOWER on IntegriCloud