Author: pfg
Date: Mon May  1 00:42:31 2017
New Revision: 317613
URL: https://svnweb.freebsd.org/changeset/base/317613

Log:
  MFC r317372:
  scandir(3): promote arraysz to size_t to match numitems.
  
  The internal array size goes through a loop and is compared with numitems
  which at its limits makes can be unreachably higher than arraysz.
  Prevent an hypothetical overflow, and signed/unsigned comparison, by
  matching the types.

Modified:
  stable/11/lib/libc/gen/scandir.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/gen/scandir.c
==============================================================================
--- stable/11/lib/libc/gen/scandir.c    Sun Apr 30 22:38:15 2017        
(r317612)
+++ stable/11/lib/libc/gen/scandir.c    Mon May  1 00:42:31 2017        
(r317613)
@@ -82,8 +82,7 @@ scandir(const char *dirname, struct dire
 #endif
 {
        struct dirent *d, *p, **names = NULL;
-       size_t numitems;
-       long arraysz;
+       size_t arraysz, numitems;
        DIR *dirp;
 
        if ((dirp = opendir(dirname)) == NULL)
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to