Blob Blame History Raw
diff -up cups-1.7.1/scheduler/client.c.str4366 cups-1.7.1/scheduler/client.c
--- cups-1.7.1/scheduler/client.c.str4366	2014-03-06 10:56:08.501062334 +0000
+++ cups-1.7.1/scheduler/client.c	2014-03-06 10:56:26.223150784 +0000
@@ -3010,6 +3010,17 @@ cupsdWriteClient(cupsd_client_t *con)	/*
     con->file_ready = 0;
   }
 
+  bytes = (ssize_t)(sizeof(con->header) - (size_t)con->header_used);
+
+  if (!con->pipe_pid && bytes > con->http.data_remaining)
+  {
+   /*
+    * Limit GET bytes to original size of file (STR #3265)...
+    */
+
+    bytes = (ssize_t)con->http.data_remaining;
+  }
+
   if (con->response && con->response->state != IPP_DATA)
   {
     int wused = con->http.wused;	/* Previous write buffer use */
@@ -3052,8 +3063,7 @@ cupsdWriteClient(cupsd_client_t *con)	/*
                     con->http.fd, (int)bytes, con->http.state,
                     CUPS_LLCAST con->http.data_remaining);
   }
-  else if ((bytes = read(con->file, con->header + con->header_used,
-			 sizeof(con->header) - con->header_used)) > 0)
+  else if ((bytes = read(con->file, con->header + con->header_used, (size_t)bytes)) > 0)
   {
     con->header_used += bytes;