diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2003-08-28 22:03:19 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2003-08-28 22:03:19 +0000 |
commit | e7bdfccb3f1bae2159f14f65be90e6966c21c725 (patch) | |
tree | 47238b16fe64a7d0b3ed79e082ad35f9358ac2c4 | |
parent | 83e4a5bccf3b06f9b2cbd708d48d1ea0602297c6 (diff) | |
download | busybox-e7bdfccb3f1bae2159f14f65be90e6966c21c725.tar.gz |
"When the initial request by wget is responded by a 3XX redirect
response sent in chunked transfer encoding, the code path to
resubmit the request to the redirected URL forgets to reset
got_clen and chunked variables in the loop. If the redirected
URL does not use chunked transfer encoding, this causes the code
that slurps the body of the response to incorrectly try to parse
out the chunk length which does not exist." - junkio@
----------------------------------------------------------------------
-rw-r--r-- | networking/wget.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/networking/wget.c b/networking/wget.c index 586a7e0d4..4a10a307e 100644 --- a/networking/wget.c +++ b/networking/wget.c @@ -295,6 +295,8 @@ int wget_main(int argc, char **argv) * HTTP session */ do { + got_clen = chunked = 0; + if (! --try) close_delete_and_die("too many redirections"); @@ -337,7 +339,8 @@ int wget_main(int argc, char **argv) /* * Retrieve HTTP response line and check for "200" status code. */ -read_response: if (fgets(buf, sizeof(buf), sfp) == NULL) +read_response: + if (fgets(buf, sizeof(buf), sfp) == NULL) close_delete_and_die("no response from server"); for (s = buf ; *s != '\0' && !isspace(*s) ; ++s) @@ -816,7 +819,7 @@ progressmeter(int flag) * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: wget.c,v 1.55 2003/08/28 21:55:22 bug1 Exp $ + * $Id: wget.c,v 1.56 2003/08/28 22:03:19 bug1 Exp $ */ |