--- cups-1.4.6.orig/scheduler/cups-lpd.c 2014-01-17 13:09:37.477146143 +0100 +++ cups-1.4.6/scheduler/cups-lpd.c 2014-01-17 22:08:22.234046114 +0100 @@ -886,6 +886,7 @@ { http_t *http; /* HTTP connection */ int i; /* Looping var */ + long l; /* Looping var for hugh loops */ int status; /* Command status */ int fd; /* Temporary file */ FILE *fp; /* File pointer */ @@ -958,6 +959,7 @@ status = 0; num_data = 0; fd = -1; + bytes = 0; control[0] = '\0'; @@ -1073,13 +1075,16 @@ /* * Copy the data or control file from the client... */ + /* + * syslog(LOG_INFO, "count=%s lcount=%ld sizeof_line %d", id, count, atol(count), sizeof(line)); + */ - for (i = atoi(count); i > 0; i -= bytes) + for (l = atol(count); l > 0; l -= bytes) { - if (i > sizeof(line)) + if (l > (long)(sizeof(line))) bytes = sizeof(line); else - bytes = i; + bytes = (int)l; if ((bytes = fread(line, 1, bytes, stdin)) > 0) bytes = write(fd, line, bytes);