Closed xypron closed 3 months ago
Describe the bug
cups-browsed runs into an infinite loop in httpGets.
To Reproduce
The issues was sometimes observed in cups-browsed on Ubuntu 24.04. See https://bugs.launchpad.net/ubuntu/+source/cups-browsed/+bug/2049315.
Expected behavior
httpGets2 should not enter an endless loop if a connection error occurs or the webserver provides invalid data.
System Information:
Additional context
Debugging showed negative values of http->used in httpGets.
Some error paths lead to negative numbers being added to http->used. The following diff should avoid this:
diff --git a/cups/http.c b/cups/http.c index c154412b1..57db33ae3 100644 --- a/cups/http.c +++ b/cups/http.c @@ -1091,6 +1091,7 @@ httpGets2(http_t *http, // I - HTTP connection continue; http->error = WSAGetLastError(); + return (NULL); } else if (WSAGetLastError() != http->error) { @@ -1113,6 +1114,7 @@ httpGets2(http_t *http, // I - HTTP connection continue; http->error = errno; + return (NULL); } else if (errno != http->error) {
The discussion happens on the PR, setting the correct label.
[master c89dd9049] Fix httpGets timeout handling (Issue #879)
[2.4.x cde48f022] Fix httpGets timeout handling (Issue #879)
Describe the bug
cups-browsed runs into an infinite loop in httpGets.
To Reproduce
The issues was sometimes observed in cups-browsed on Ubuntu 24.04. See https://bugs.launchpad.net/ubuntu/+source/cups-browsed/+bug/2049315.
Expected behavior
httpGets2 should not enter an endless loop if a connection error occurs or the webserver provides invalid data.
System Information:
Additional context
Debugging showed negative values of http->used in httpGets.
Some error paths lead to negative numbers being added to http->used. The following diff should avoid this: