svn commit: r206025 - in stable: 6/libexec/ftpd 7/libexec/ftpd 8/libexec/ftpd

Xin LI delphij at FreeBSD.org
Thu Apr 1 00:38:39 UTC 2010


Author: delphij
Date: Thu Apr  1 00:38:38 2010
New Revision: 206025
URL: http://svn.freebsd.org/changeset/base/206025

Log:
  MFC r205656:
  
  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

Modified:
  stable/6/libexec/ftpd/popen.c
Directory Properties:
  stable/6/libexec/ftpd/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/7/libexec/ftpd/popen.c
  stable/8/libexec/ftpd/popen.c
Directory Properties:
  stable/7/libexec/ftpd/   (props changed)
  stable/8/libexec/ftpd/   (props changed)

Modified: stable/6/libexec/ftpd/popen.c
==============================================================================
--- stable/6/libexec/ftpd/popen.c	Thu Apr  1 00:36:40 2010	(r206024)
+++ stable/6/libexec/ftpd/popen.c	Thu Apr  1 00:38:38 2010	(r206025)
@@ -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;


More information about the svn-src-stable-6 mailing list