]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Limit the maximum number of file descriptors to 64k-1 (Issue #989)
authorMichael R Sweet <msweet@msweet.org>
Thu, 20 Jun 2024 12:45:11 +0000 (08:45 -0400)
committerMichael R Sweet <msweet@msweet.org>
Thu, 20 Jun 2024 12:45:11 +0000 (08:45 -0400)
CHANGES.md
scheduler/main.c

index cd98dd14b73cbf8b058872cc0e941acdf29007c6..6a2f18139b99c8ecd649f3f9fd000560067acb0c 100644 (file)
@@ -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)
index 5a63829d2b380a6137025761a559efe5cee0d837..62fa8e8dd08f0fe1da29d518aa6422cbe250e818 100644 (file)
@@ -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;