diff options
author | delphij <delphij@FreeBSD.org> | 2010-03-25 22:41:01 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2010-03-25 22:41:01 +0000 |
commit | e7582f97cf11dcc14c6007537f2336bd83e20cde (patch) | |
tree | 76302fd003e1a5e303318e535032d9d7327a01c2 /libexec | |
parent | 54c5278fbd78e51eadbda5e9c67c741e5bc5880f (diff) | |
download | FreeBSD-src-e7582f97cf11dcc14c6007537f2336bd83e20cde.zip FreeBSD-src-e7582f97cf11dcc14c6007537f2336bd83e20cde.tar.gz |
Check that gl_pathc is bigger than zero before derefencing gl_pathv.
When gl_pathc == 0, the content of gl_pathv is undefined.
PR: bin/144761
Submitted by: David BERARD <contact davidberard fr>
Obtained from: OpenBSD
MFC after: 1 week
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/ftpd/popen.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libexec/ftpd/popen.c b/libexec/ftpd/popen.c index 3c187b9..8a739dc 100644 --- a/libexec/ftpd/popen.c +++ b/libexec/ftpd/popen.c @@ -110,10 +110,11 @@ ftpd_popen(char *program, char *type) flags |= GLOB_LIMIT; if (glob(argv[argc], flags, NULL, &gl)) gargv[gargc++] = strdup(argv[argc]); - else + else if (gl.gl_pathc > 0) { for (pop = gl.gl_pathv; *pop && gargc < (MAXGLOBARGS-1); pop++) gargv[gargc++] = strdup(*pop); + } globfree(&gl); } gargv[gargc] = NULL; |