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 by matching the types.

MFC after:	1 week
This commit is contained in:
Pedro F. Giffuni 2017-04-24 14:56:41 +00:00
parent fa903e5725
commit 5f2bd3bdac
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=317372

View File

@ -82,8 +82,7 @@ scandir(const char *dirname, struct dirent ***namelist,
#endif
{
struct dirent *d, *p, **names = NULL;
size_t numitems;
long arraysz;
size_t arraysz, numitems;
DIR *dirp;
if ((dirp = opendir(dirname)) == NULL)