diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2006-05-18 18:41:18 +0200 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2006-05-18 18:41:18 +0200 |
commit | 0eec3866ac883667045cc028d5f0dac0b4872de7 (patch) | |
tree | 2e4e0d9d247d6f57c127d2ce60c2a55848f22311 /protocols/http_client.c | |
parent | 266fe2fe078833bc5489a3fddd970b9307a7bbfa (diff) |
Added a body_size attribute to http_client and fixed a possible NULL
dereference bug.
Diffstat (limited to 'protocols/http_client.c')
-rw-r--r-- | protocols/http_client.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/protocols/http_client.c b/protocols/http_client.c index 46cb8b7b..49e6dd83 100644 --- a/protocols/http_client.c +++ b/protocols/http_client.c @@ -252,21 +252,24 @@ got_reply: end1 = end2 + 1; evil_server = 1; } - else + else if( end1 ) { end1 += 2; } - - if( end1 ) + else { - *end1 = 0; - - if( evil_server ) - req->reply_body = end1 + 1; - else - req->reply_body = end1 + 2; + goto cleanup; } + *end1 = 0; + + if( evil_server ) + req->reply_body = end1 + 1; + else + req->reply_body = end1 + 2; + + req->body_size = req->reply_headers + bytes_read - req->reply_body; + if( ( end1 = strchr( req->reply_headers, ' ' ) ) != NULL ) { if( sscanf( end1 + 1, "%d", &req->status_code ) != 1 ) |