Date: Thu, 25 Mar 2010 22:41:01 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r205656 - head/libexec/ftpd Message-ID: <201003252241.o2PMf1aX057819@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Thu Mar 25 22:41:01 2010 New Revision: 205656 URL: http://svn.freebsd.org/changeset/base/205656 Log: 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 Modified: head/libexec/ftpd/popen.c Modified: head/libexec/ftpd/popen.c ============================================================================== --- head/libexec/ftpd/popen.c Thu Mar 25 20:07:30 2010 (r205655) +++ head/libexec/ftpd/popen.c Thu Mar 25 22:41:01 2010 (r205656) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003252241.o2PMf1aX057819>