summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert James Kaes <rjkaes@users.sourceforge.net>2001-08-27 03:44:22 +0000
committerRobert James Kaes <rjkaes@users.sourceforge.net>2001-08-27 03:44:22 +0000
commit771425700d849ac1fdacf82ea366cf5eeb02a30a (patch)
treea25ba64788caf6af055108438f34fa9bc1596a65
parent7be408859d438261ad3a6a467c7dc3b7004e3d07 (diff)
downloadtinyproxy-771425700d849ac1fdacf82ea366cf5eeb02a30a.tar.gz
tinyproxy-771425700d849ac1fdacf82ea366cf5eeb02a30a.zip
Fixed a SEGV problem with invalid requests.
-rw-r--r--src/reqs.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/reqs.c b/src/reqs.c
index d29b332..97224d8 100644
--- a/src/reqs.c
+++ b/src/reqs.c
@@ -1,4 +1,4 @@
-/* $Id: reqs.c,v 1.15 2001-08-26 21:11:55 rjkaes Exp $
+/* $Id: reqs.c,v 1.16 2001-08-27 03:44:22 rjkaes Exp $
*
* This is where all the work in tinyproxy is actually done. Incoming
* connections have a new thread created for them. The thread then
@@ -122,14 +122,14 @@ static int process_method(struct conn_s *connptr)
log_message(LOG_ERR, "clientreq: regcomp");
httperr(connptr, 503, HTTP503ERROR);
update_stats(STAT_BADCONN);
- goto COMMON_EXIT;
+ goto EARLY_EXIT;
}
if (regexec(&preg, inbuf, NMATCH, pmatch, 0) != 0) {
log_message(LOG_ERR, "clientreq: regexec");
regfree(&preg);
httperr(connptr, 503, HTTP503ERROR);
update_stats(STAT_BADCONN);
- goto COMMON_EXIT;
+ goto EARLY_EXIT;
}
regfree(&preg);
@@ -147,7 +147,7 @@ static int process_method(struct conn_s *connptr)
peer_ipaddr, inbuf);
httperr(connptr, 400, HTTP400ERROR);
update_stats(STAT_BADCONN);
- goto COMMON_EXIT;
+ goto EARLY_EXIT;
}
len = pmatch[URI_IND].rm_eo - pmatch[URI_IND].rm_so;
@@ -157,7 +157,7 @@ static int process_method(struct conn_s *connptr)
peer_ipaddr);
httperr(connptr, 503, HTTP503ERROR);
update_stats(STAT_BADCONN);
- goto COMMON_EXIT;
+ goto EARLY_EXIT;
}
memcpy(buffer, inbuf + pmatch[URI_IND].rm_so, len);
buffer[len] = '\0';
@@ -166,7 +166,7 @@ static int process_method(struct conn_s *connptr)
log_message(LOG_ERR, "clientreq: Problem with explode_uri");
httperr(connptr, 503, HTTP503ERROR);
update_stats(STAT_BADCONN);
- goto COMMON_EXIT;
+ goto EARLY_EXIT;
}
safefree(buffer);
@@ -287,9 +287,11 @@ static int process_method(struct conn_s *connptr)
free_uri(uri);
return 0;
- COMMON_EXIT:
- safefree(request);
+COMMON_EXIT:
free_uri(uri);
+
+EARLY_EXIT:
+ safefree(request);
return -1;
}