37 lines
1.2 KiB
Diff
37 lines
1.2 KiB
Diff
|
Index: scheduler/cups-lpd.c
|
||
|
===================================================================
|
||
|
--- scheduler/cups-lpd.c (revision 11557)
|
||
|
+++ scheduler/cups-lpd.c (revision 11558)
|
||
|
@@ -781,7 +770,8 @@
|
||
|
int fd; /* Temporary file */
|
||
|
FILE *fp; /* File pointer */
|
||
|
char filename[1024]; /* Temporary filename */
|
||
|
- int bytes; /* Bytes received */
|
||
|
+ ssize_t bytes; /* Bytes received */
|
||
|
+ size_t total; /* Total bytes */
|
||
|
char line[256], /* Line from file/stdin */
|
||
|
command, /* Command from line */
|
||
|
*count, /* Number of bytes */
|
||
|
@@ -965,15 +955,15 @@
|
||
|
* Copy the data or control file from the client...
|
||
|
*/
|
||
|
|
||
|
- for (i = atoi(count); i > 0; i -= bytes)
|
||
|
+ for (total = (size_t)strtoll(count, NULL, 10); total > 0; total -= (size_t)bytes)
|
||
|
{
|
||
|
- if (i > sizeof(line))
|
||
|
- bytes = sizeof(line);
|
||
|
+ if (total > sizeof(line))
|
||
|
+ bytes = (ssize_t)sizeof(line);
|
||
|
else
|
||
|
- bytes = i;
|
||
|
+ bytes = (ssize_t)total;
|
||
|
|
||
|
- if ((bytes = fread(line, 1, bytes, stdin)) > 0)
|
||
|
- bytes = write(fd, line, bytes);
|
||
|
+ if ((bytes = (ssize_t)fread(line, 1, (size_t)bytes, stdin)) > 0)
|
||
|
+ bytes = write(fd, line, (size_t)bytes);
|
||
|
|
||
|
if (bytes < 1)
|
||
|
{
|