From 771425700d849ac1fdacf82ea366cf5eeb02a30a Mon Sep 17 00:00:00 2001 From: Robert James Kaes Date: Mon, 27 Aug 2001 03:44:22 +0000 Subject: Fixed a SEGV problem with invalid requests. --- src/reqs.c | 18 ++++++++++-------- 1 file 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; } -- cgit v1.2.3