Skip to content

Commit 7f99d0c

Browse files
Merge pull request #1408 from AZero13/cve
Do not allow negative file descriptors to be closed
2 parents 4c51060 + d7fb19d commit 7f99d0c

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

backend/lpd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
523523
if (tmpfilename[0])
524524
unlink(tmpfilename);
525525

526-
if (fd)
526+
if (fd > 0)
527527
close(fd);
528528

529529
if (snmp_fd >= 0)
@@ -948,7 +948,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
948948
* Next, open the print file and figure out its size...
949949
*/
950950

951-
if (print_fd)
951+
if (print_fd > 0)
952952
{
953953
/*
954954
* Use the size from the print file...

filter/rastertoepson.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ main(int argc, /* I - Number of command-line arguments */
11411141
*/
11421142

11431143
cupsRasterClose(ras);
1144-
if (fd != 0)
1144+
if (fd > 0)
11451145
close(fd);
11461146

11471147
/*

filter/rastertohp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ main(int argc, /* I - Number of command-line arguments */
813813
*/
814814

815815
cupsRasterClose(ras);
816-
if (fd != 0)
816+
if (fd > 0)
817817
close(fd);
818818

819819
/*

filter/rastertolabel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,7 @@ main(int argc, /* I - Number of command-line arguments */
12631263
*/
12641264

12651265
cupsRasterClose(ras);
1266-
if (fd != 0)
1266+
if (fd > 0)
12671267
close(fd);
12681268

12691269
/*

filter/rastertopwg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ main(int argc, /* I - Number of command-line args */
490490
}
491491

492492
cupsRasterClose(inras);
493-
if (fd)
493+
if (fd > 0)
494494
close(fd);
495495

496496
cupsRasterClose(outras);

0 commit comments

Comments
 (0)