Skip to content

Commit

Permalink
Limit the maximum number of file descriptors to 64k-1 (Issue #989)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Jun 20, 2024
1 parent 3933e01 commit a66f419
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Changes in CUPS v2.5b1 (TBA)
- Updated `cupsRasterReadPixels` and `cupsRasterWritePixels` to not try reading
or writing if the number of bytes passed is 0 (Issue #914)
- Updated and documented the MIME typing buffering limit (Issue #925)
- Updated the maximum file descriptor limit for `cupsd` to 64k-1 (Issue #989)
- Fixed use-after-free in `cupsdAcceptClient()` when we log warning during error
handling (fixes CVE-2023-34241)
- Fixed hanging of `lpstat` on Solaris (Issue #156)
Expand Down
11 changes: 4 additions & 7 deletions scheduler/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,17 +503,14 @@ main(int argc, /* I - Number of command-line args */
#endif /* HAVE_DBUS_THREADS_INIT */

/*
* Set the maximum number of files...
* Set the maximum number of files, which for practical reasons can be limited
* to the number of TCP port number values (64k-1)...
*/

getrlimit(RLIMIT_NOFILE, &limit);

#ifdef RLIM_INFINITY
if (limit.rlim_max == RLIM_INFINITY)
MaxFDs = 16384;
else
#endif /* RLIM_INFINITY */
MaxFDs = limit.rlim_max;
if ((MaxFDs = limit.rlim_max) > 65535)
MaxFDs = 65535;

limit.rlim_cur = (rlim_t)MaxFDs;

Expand Down

0 comments on commit a66f419

Please sign in to comment.