Author: delphij Date: Mon Oct 5 21:11:04 2009 New Revision: 197793 URL: http://svn.freebsd.org/changeset/base/197793
Log: fts_open() requires that the list passed as argument to contain at least one path. When the list is empty (contain only a NULL pointer), return EINVAL instead of pretending to succeed, which will cause a NULL pointer deference in a later fts_read() call. Noticed by: Christoph Mallon (via rdivacky@) MFC after: 2 weeks Modified: head/lib/libc/gen/fts.3 head/lib/libc/gen/fts.c Modified: head/lib/libc/gen/fts.3 ============================================================================== --- head/lib/libc/gen/fts.3 Mon Oct 5 20:38:36 2009 (r197792) +++ head/lib/libc/gen/fts.3 Mon Oct 5 21:11:04 2009 (r197793) @@ -28,7 +28,7 @@ .\" @(#)fts.3 8.5 (Berkeley) 4/16/94 .\" $FreeBSD$ .\" -.Dd January 26, 2008 +.Dd October 5, 2009 .Dt FTS 3 .Os .Sh NAME @@ -776,7 +776,7 @@ may fail and set as follows: .Bl -tag -width Er .It Bq Er EINVAL -The options were invalid. +The options were invalid, or the list were empty. .El .Sh SEE ALSO .Xr find 1 , Modified: head/lib/libc/gen/fts.c ============================================================================== --- head/lib/libc/gen/fts.c Mon Oct 5 20:38:36 2009 (r197792) +++ head/lib/libc/gen/fts.c Mon Oct 5 21:11:04 2009 (r197793) @@ -124,6 +124,12 @@ fts_open(argv, options, compar) return (NULL); } + /* fts_open() requires at least one path */ + if (*argv == NULL) { + errno = EINVAL; + return (NULL); + } + /* Allocate/initialize the stream. */ if ((priv = malloc(sizeof(*priv))) == NULL) return (NULL); _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"