--------------------- PatchSet 10382 Date: 2008/01/09 08:44:49 Author: adri Branch: s27_adri Tag: (none) Log: Remove the NUL-termination of the incoming client-side buffer. This is partly because I want to find places where the NUL termination is required, and parly because I (eventually) don't want the buffer modified anywhere outside of a small number of places (when the buffer is read into, in clientReadReply()). Members: src/client_side.c:1.202.2.9.4.25->1.202.2.9.4.26 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.202.2.9.4.25 retrieving revision 1.202.2.9.4.26 diff -u -r1.202.2.9.4.25 -r1.202.2.9.4.26 --- squid/src/client_side.c 5 Jan 2008 09:42:40 -0000 1.202.2.9.4.25 +++ squid/src/client_side.c 9 Jan 2008 08:44:49 -0000 1.202.2.9.4.26 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.202.2.9.4.25 2008/01/05 09:42:40 adri Exp $ + * $Id: client_side.c,v 1.202.2.9.4.26 2008/01/09 08:44:49 adri Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -3919,7 +3919,6 @@ xmemmove(conn->in.buf, conn->in.buf + 1, conn->in.offset - 1); conn->in.offset--; } - conn->in.buf[conn->in.offset] = '\0'; /* Terminate the string */ if (conn->in.offset == 0) return 0; @@ -3932,7 +3931,6 @@ conn->defer.until = squid_curtime + 100; /* Reset when a request is complete */ return 0; } - conn->in.buf[conn->in.offset] = '\0'; /* Terminate the string */ if (nrequests == 0) fd_note_static(conn->fd, "Reading next request"); /* Process request */ @@ -3950,7 +3948,7 @@ debug(33, 1) ("clientReadRequest: FD %d (%s:%d) Invalid Request\n", fd, fd_table[fd].ipaddr, fd_table[fd].remote_port); err = errorCon(ERR_INVALID_REQ, HTTP_BAD_REQUEST, NULL); err->src_addr = conn->peer.sin_addr; - err->request_hdrs = xstrdup(conn->in.buf); + err->request_hdrs = xstrndup(conn->in.buf, conn->in.offset); http->log_type = LOG_TCP_DENIED; http->entry = clientCreateStoreEntry(http, method, null_request_flags); errorAppendEntry(http->entry, err); @@ -4147,7 +4145,6 @@ */ if (size > 0) { conn->in.offset += size; - conn->in.buf[conn->in.offset] = '\0'; /* Terminate the string */ } else if (size == 0) { if (DLINK_ISEMPTY(conn->reqs) && conn->in.offset == 0) { /* no current or pending requests */