Prevent feedback loop when fetching error_log over HTTP (STR #4366).

This commit is contained in:
Tim Waugh 2014-03-06 10:57:43 +00:00
parent fee478c5ac
commit 3933cbca34
2 changed files with 38 additions and 1 deletions

31
cups-str4366.patch Normal file
View File

@ -0,0 +1,31 @@
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;

View File

@ -11,7 +11,7 @@ Summary: CUPS printing system
Name: cups
Epoch: 1
Version: 1.7.1
Release: 5%{?dist}
Release: 6%{?dist}
License: GPLv2
Group: System Environment/Daemons
Url: http://www.cups.org/
@ -69,6 +69,7 @@ Patch41: cups-journal.patch
Patch42: cups-synconclose.patch
Patch43: cups-avahi-browse.patch
Patch44: cups-str4380.patch
Patch45: cups-str4366.patch
Patch100: cups-lspp.patch
@ -266,6 +267,8 @@ Sends IPP requests to the specified URI and tests and/or displays the results.
%patch43 -p1 -b .avahi-browse
# Fix for cupsEnumDest() 'removed' callbacks (bug #1054312, STR #4380).
%patch44 -p1 -b .str4380
# Prevent feedback loop when fetching error_log over HTTP (STR #4366).
%patch45 -p1 -b .str4366
%if %lspp
# LSPP support.
@ -646,6 +649,9 @@ rm -f %{cups_serverbin}/backend/smb
%{_mandir}/man5/ipptoolfile.5.gz
%changelog
* Thu Mar 6 2014 Tim Waugh <twaugh@redhat.com> - 1:1.7.1-6
- Prevent feedback loop when fetching error_log over HTTP (STR #4366).
* Wed Mar 5 2014 Tim Waugh <twaugh@redhat.com> - 1:1.7.1-5
- Fix for cupsEnumDest() 'removed' callbacks (bug #1054312, STR #4380).