/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to plugin-runner.c

  • Committer: Teddy Hogeborn
  • Date: 2014-06-14 02:57:16 UTC
  • Revision ID: teddy@recompile.se-20140614025716-i6887rk3u1iy9l67
In plugin-runner, protect against a larger FD_SETSIZE than fd_set.

* plugin-runner.c (main): Before forking, check that the first FD from
                          pipe() does not exceed FD_SETSIZE.

Show diffs side-by-side

added added

removed removed

Lines of Context:
981
981
      exitstatus = EX_OSERR;
982
982
      goto fallback;
983
983
    }
 
984
    if(pipefd[0] >= FD_SETSIZE){
 
985
      fprintf(stderr, "pipe()[0] (%d) >= FD_SETSIZE (%d)", pipefd[0],
 
986
              FD_SETSIZE);
 
987
      TEMP_FAILURE_RETRY(close(pipefd[0]));
 
988
      TEMP_FAILURE_RETRY(close(pipefd[1]));
 
989
      exitstatus = EX_OSERR;
 
990
      goto fallback;
 
991
    }
984
992
    /* Ask OS to automatic close the pipe on exec */
985
993
    ret = set_cloexec_flag(pipefd[0]);
986
994
    if(ret < 0){