summaryrefslogtreecommitdiffhomepage
path: root/src/reqs.c
diff options
context:
space:
mode:
authorRobert James Kaes <rjkaes@users.sourceforge.net>2003-06-06 16:14:50 +0000
committerRobert James Kaes <rjkaes@users.sourceforge.net>2003-06-06 16:14:50 +0000
commitb081019d5ab9a0247f7d6fb5592efa4b8f49b81b (patch)
tree406dcb2b4f33990526725e0866850378930c80bb /src/reqs.c
parentc2240df6161d0b83b220d23bb4baa15a7fb7fc2f (diff)
(connect_to_upstream): Fixed an off-by-one error in the snprintf()
call used to build the URL for the upstream proxy. [Patch suggested by David T. Pierso]
Diffstat (limited to 'src/reqs.c')
-rw-r--r--src/reqs.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/reqs.c b/src/reqs.c
index 0a0b9a7..a54535c 100644
--- a/src/reqs.c
+++ b/src/reqs.c
@@ -1,4 +1,4 @@
-/* $Id: reqs.c,v 1.102 2003-06-02 21:55:14 rjkaes Exp $
+/* $Id: reqs.c,v 1.103 2003-06-06 16:14:50 rjkaes Exp $
*
* This is where all the work in tinyproxy is actually done. Incoming
* connections have a new child created for them. The child then
@@ -1437,9 +1437,9 @@ connect_to_upstream(struct conn_s *connptr, struct request_s *request)
* method and path.
*/
if (connptr->connect_method) {
- len = strlen(request->host) + 6;
+ len = strlen(request->host) + 7;
- combined_string = safemalloc(len + 1);
+ combined_string = safemalloc(len);
if (!combined_string) {
return -1;
}
@@ -1448,7 +1448,7 @@ connect_to_upstream(struct conn_s *connptr, struct request_s *request)
request->port);
} else {
len = strlen(request->host) + strlen(request->path) + 14;
- combined_string = safemalloc(len + 1);
+ combined_string = safemalloc(len);
if (!combined_string) {
return -1;
}
@@ -1457,7 +1457,8 @@ connect_to_upstream(struct conn_s *connptr, struct request_s *request)
request->port, request->path);
}
- safefree(request->path);
+ if (request->path)
+ safefree(request->path);
request->path = combined_string;
return establish_http_connection(connptr, request);