summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-10-15 08:24:07 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-10-15 08:24:07 +0000
commit79e90a3a353a30c528789994221e368579d675fb (patch)
treeeeecd40e56c818b2e7333d0b19ec82208c673e66 /libexec
parent5b72d0d9d08d4ad355cfe89b6fa480bf75f05e55 (diff)
nearly impossible oflow
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ftpd/popen.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libexec/ftpd/popen.c b/libexec/ftpd/popen.c
index f67006fc4c8..b8d5c5a5f70 100644
--- a/libexec/ftpd/popen.c
+++ b/libexec/ftpd/popen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: popen.c,v 1.4 1996/07/30 02:01:16 downsj Exp $ */
+/* $OpenBSD: popen.c,v 1.5 1996/10/15 08:24:06 deraadt Exp $ */
/* $NetBSD: popen.c,v 1.5 1995/04/11 02:45:00 cgd Exp $ */
/*
@@ -102,9 +102,10 @@ ftpd_popen(program, type)
int flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE;
memset(&gl, 0, sizeof(gl));
- if (glob(argv[argc], flags, NULL, &gl))
- gargv[gargc++] = strdup(argv[argc]);
- else
+ if (glob(argv[argc], flags, NULL, &gl)) {
+ if (gargc < 1000)
+ gargv[gargc++] = strdup(argv[argc]);
+ } else
for (pop = gl.gl_pathv; *pop && gargc < 1000; pop++)
gargv[gargc++] = strdup(*pop);
globfree(&gl);