X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;f=jcc.c;h=12e7736499d5b034afc6cd7be3e82709c79e73b0;hb=78619a0f9d61b2e4bbf9b940f1a92bd09981ced6;hp=c1a3a6e795deb39108c60bf34ed5e52c5adaee4a;hpb=f165809077f7b3c48ebc6aa074b64e7364f3e1bc;p=privoxy.git diff --git a/jcc.c b/jcc.c index c1a3a6e7..12e77364 100644 --- a/jcc.c +++ b/jcc.c @@ -1153,10 +1153,10 @@ static void wait_for_alive_connections(void) * Returns : void * *********************************************************************/ -void save_connection_destination(jb_socket sfd, - const struct http_request *http, - const struct forward_spec *fwd, - struct reusable_connection *server_connection) +static void save_connection_destination(jb_socket sfd, + const struct http_request *http, + const struct forward_spec *fwd, + struct reusable_connection *server_connection) { assert(sfd != JB_INVALID_SOCKET); assert(NULL != http->host); @@ -1503,6 +1503,12 @@ static enum chunk_status chunked_body_is_complete(struct iob *iob, size_t *lengt /* Move beyond the chunkdata. */ p += 2 + chunksize; + /* Make sure we're still within the buffer and have two bytes left */ + if (p + 2 > iob->eod) + { + return CHUNK_STATUS_MISSING_DATA; + } + /* There should be another "\r\n" to skip */ if (memcmp(p, "\r\n", 2)) { @@ -4811,7 +4817,8 @@ static void serve(struct client_state *csp) log_error(LOG_LEVEL_CONNECT, "Closing server socket %d connected to %s. " "Keep-alive: %u. Tainted: %u. Socket alive: %u. Timeout: %u.", - csp->server_connection.sfd, csp->server_connection.host, + csp->server_connection.sfd, (csp->server_connection.host != NULL) ? + csp->server_connection.host : csp->http->host, 0 != (csp->flags & CSP_FLAG_SERVER_CONNECTION_KEEP_ALIVE), 0 != (csp->flags & CSP_FLAG_SERVER_SOCKET_TAINTED), socket_is_still_alive(csp->server_connection.sfd),