mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-09 15:20:56 -06:00
KWSys Directory: Check opendir return value before using it (#15367)
In Directory::GetNumberOfFilesInDirectory add a missing check for NULL.
This commit is contained in:
@@ -239,6 +239,11 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const kwsys_stl::string& na
|
||||
{
|
||||
DIR* dir = opendir(name.c_str());
|
||||
|
||||
if (!dir)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned long count = 0;
|
||||
for (dirent* d = readdir(dir); d; d = readdir(dir) )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user