Skip to content

Commit

Permalink
Merge pull request #57 from gleventhal/master
Browse files Browse the repository at this point in the history
Fix unchecked opendir to prevent dereferencing a NULL pointer
  • Loading branch information
Atoptool committed May 26, 2019
2 parents fa4db43 + e7000f7 commit b54801c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions photoproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,12 @@ photoproc(struct tstat *tasklist, int maxtask)
{
dirtask = opendir(".");

if( dirtask == NULL )
{
if(chdir("../..") == -1); /* leave task and process-level directories */
continue;
}

while ((tent=readdir(dirtask)) && tval<maxtask)
{
struct tstat *curthr = tasklist+tval;
Expand Down

0 comments on commit b54801c

Please sign in to comment.