diff options
author | Michael R Sweet <michael.r.sweet@gmail.com> | 2019-01-09 13:19:11 -0500 |
---|---|---|
committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2019-01-09 13:19:11 -0500 |
commit | 96fee30386eebf99cda80c063591a1b1bc051907 (patch) | |
tree | 2eb2f3f9c9ab9e7e0502e3edf2518569ccbcf7ef /cups | |
parent | f294fe22fd8ea4283a4bbaa3093b98549750b43d (diff) |
Protect against continuing to read from a file at EOF (Issue #5473)
Diffstat (limited to 'cups')
-rw-r--r-- | cups/file.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/cups/file.c b/cups/file.c index 324abe26d..e6e1f5b82 100644 --- a/cups/file.c +++ b/cups/file.c @@ -6,7 +6,7 @@ * our own file functions allows us to provide transparent support of * different line endings, gzip'd print files, PPD files, etc. * - * Copyright © 2007-2018 by Apple Inc. + * Copyright © 2007-2019 by Apple Inc. * Copyright © 1997-2007 by Easy Software Products, all rights reserved. * * Licensed under Apache License v2.0. See the file "LICENSE" for more @@ -675,6 +675,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... */ @@ -1647,6 +1653,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... */ |