]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Protect against continuing to read from a file at EOF (Issue #5473)
authorMichael R Sweet <michael.r.sweet@gmail.com>
Wed, 9 Jan 2019 18:26:37 +0000 (13:26 -0500)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Wed, 9 Jan 2019 18:26:37 +0000 (13:26 -0500)
CHANGES.md
cups/file.c

index 2ea55eff11cdfb103716c39fcf40cc2408c34e22..8e5d2bae8e7d9a0a139bdb0d179c4faf250bfcc8 100644 (file)
@@ -1,4 +1,4 @@
-CHANGES - 2.2.11 - 2018-12-14
+CHANGES - 2.2.11 - 2019-01-09
 =============================
 
 Changes in CUPS v2.2.11
@@ -6,6 +6,7 @@ Changes in CUPS v2.2.11
 
 - Running ppdmerge with the same input and output filenames did not work as
   advertised (Issue #5455)
+- Fixed a potential memory leak when reading at the end of a file (Issue #5473)
 - Fixed a potential crash bug in cups-driverd (rdar://46625579)
 
 
index 5c9ddf8fe5c92db1491ca29a260b8352939d898a..f67a6668e5af4043bcd8d78cfeab9cfb87b31507 100644 (file)
@@ -679,6 +679,12 @@ cupsFileGetChar(cups_file_t *fp)   /* I - CUPS file */
     return (-1);
   }
 
+  if (fp->eof)
+  {
+    DEBUG_puts("5cupsFileGetChar: End-of-file!");
+    return (-1);
+  }
+
  /*
   * If the input buffer is empty, try to read more data...
   */
@@ -1651,6 +1657,12 @@ cupsFileRead(cups_file_t *fp,            /* I - CUPS file */
   if (bytes == 0)
     return (0);
 
+  if (fp->eof)
+  {
+    DEBUG_puts("5cupsFileRead: End-of-file!");
+    return (-1);
+  }
+
  /*
   * Loop until all bytes are read...
   */