Blob Blame History Raw
diff -up cups-1.6.4/scheduler/client.c.str4366 cups-1.6.4/scheduler/client.c
--- cups-1.6.4/scheduler/client.c.str4366	2014-03-11 15:36:32.702481538 +0000
+++ cups-1.6.4/scheduler/client.c	2014-03-11 15:40:08.424838223 +0000
@@ -2777,14 +2777,24 @@ 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)
   {
     ipp_state = ippWrite(HTTP(con), con->response);
     bytes     = ipp_state != IPP_ERROR &&
                 (con->file >= 0 || ipp_state != IPP_DATA);
   }
-  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;