]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Do not allow negative file descriptors to be closed 1408/head
authorAZero13 <gfunni234@gmail.com>
Tue, 4 Nov 2025 00:55:13 +0000 (19:55 -0500)
committerAZero13 <gfunni234@gmail.com>
Tue, 4 Nov 2025 00:55:13 +0000 (19:55 -0500)
Especially

backend/lpd.c
filter/rastertoepson.c
filter/rastertohp.c
filter/rastertolabel.c
filter/rastertopwg.c

index bc13c6f6bf55d0209af509207a6320f06acf4e7f..6a5f32ad662d693350d402cdca33575be696410d 100644 (file)
@@ -523,7 +523,7 @@ main(int  argc,                             /* I - Number of command-line arguments (6 or 7) */
   if (tmpfilename[0])
     unlink(tmpfilename);
 
-  if (fd)
+  if (fd > 0)
     close(fd);
 
   if (snmp_fd >= 0)
@@ -948,7 +948,7 @@ lpd_queue(const char      *hostname,        /* I - Host to connect to */
     * Next, open the print file and figure out its size...
     */
 
-    if (print_fd)
+    if (print_fd > 0)
     {
      /*
       * Use the size from the print file...
index 644e81e5e23ad694315cf6b09fe6cae1539951b0..9de398693556314b1d500e0eca656447497f86d1 100644 (file)
@@ -1141,7 +1141,7 @@ main(int  argc,                           /* I - Number of command-line arguments */
   */
 
   cupsRasterClose(ras);
-  if (fd != 0)
+  if (fd > 0)
     close(fd);
 
  /*
index d2743b2dd2ec87a3e4af969baa31d828f233c3f9..bb942c35956c9df3d8f2645fabb817acd34007c8 100644 (file)
@@ -813,7 +813,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
   */
 
   cupsRasterClose(ras);
-  if (fd != 0)
+  if (fd > 0)
     close(fd);
 
  /*
index 8f75e9a17691a7476fa74e8850f9a84139825fba..e196b8685b5adfbdfb4c9b7b179c870c17057408 100644 (file)
@@ -1263,7 +1263,7 @@ main(int  argc,                           /* I - Number of command-line arguments */
   */
 
   cupsRasterClose(ras);
-  if (fd != 0)
+  if (fd > 0)
     close(fd);
 
  /*
index 9c50f71a74966e43f8594fd97aa77435329a90c6..6ef0975d257b2c11a8d9370fb1e30c3a35ba8b7c 100644 (file)
@@ -490,7 +490,7 @@ main(int  argc,                             /* I - Number of command-line args */
   }
 
   cupsRasterClose(inras);
-  if (fd)
+  if (fd > 0)
     close(fd);
 
   cupsRasterClose(outras);