On Tue, 28 Jun 2016, Todd C. Miller wrote:
> I think this needs to be fixed in fts(3) instead.  The following diff 
> fixes it for me but has only been lightly tested.

As I noted in icb, first chunk looks sufficient to me; the latter chunk is 
just optimizing the error case, as fstatat() will already fail the "" 
case.

I think we should also include this check from FreeBSD:

--- gen/fts.c   16 Jan 2015 16:48:51 -0000
+++ gen/fts.c   5 Feb 2015 05:01:08 -0000
@@ -83,6 +83,12 @@ fts_open(char * const *argv, int options
                return (NULL);
        }
 
+       /* fts_open() requires at least one path */
+       if (*argv == NULL) {
+               errno = EINVAL;
+               return (NULL);
+       }
+
        /* Allocate/initialize the stream */
        if ((sp = calloc(1, sizeof(FTS))) == NULL)
                return (NULL);

Reply via email to