Date: Mon, 1 May 2017 00:42:31 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317613 - stable/11/lib/libc/gen Message-ID: <201705010042.v410gVSO057449@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705010042.v410gVSO057449>