summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRobert James Kaes <rjkaes@users.sourceforge.net>2000-03-28 16:19:12 +0000
committerRobert James Kaes <rjkaes@users.sourceforge.net>2000-03-28 16:19:12 +0000
commitd222c7725bbaabaa8e0d62a48bd167cd8ec28f29 (patch)
treeca5edc9ffde531fdc24af1b8d4bbcf8993b59b09 /src
parentc2ef08202b03bcc07e700585e29e943716734ce4 (diff)
Fixed a NULL pointer bug in clientreq. If the SCHEME in the URL was NULL
the program would SEGV. This was caused by the error logging code.
Diffstat (limited to 'src')
-rw-r--r--src/reqs.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/reqs.c b/src/reqs.c
index 0e20cdd..10efa89 100644
--- a/src/reqs.c
+++ b/src/reqs.c
@@ -1,4 +1,4 @@
-/* $Id: reqs.c,v 1.2 2000-03-11 20:37:44 rjkaes Exp $
+/* $Id: reqs.c,v 1.3 2000-03-28 16:19:12 rjkaes Exp $
*
* This is where all the work in tinyproxy is actually done. Incoming
* connections are added to the active list of connections and then the header
@@ -167,10 +167,17 @@ static int clientreq(struct conn_s *connptr)
}
safefree(buffer);
- if (strcasecmp(uri->scheme, "http") != 0) {
- char *error_string = xmalloc(strlen(uri->scheme) + 64);
- sprintf(error_string, "Invalid scheme (%s). Only HTTP is allowed.",
- uri->scheme);
+ if (!uri->scheme || strcasecmp(uri->scheme, "http") != 0) {
+ char *error_string;
+ if (uri->scheme) {
+ error_string = xmalloc(strlen(uri->scheme) + 64);
+ sprintf(error_string,
+ "Invalid scheme (%s). Only HTTP is allowed.",
+ uri->scheme);
+ } else {
+ error_string = strdup("Invalid scheme (NULL). Only HTTP is allowed.");
+ }
+
httperr(connptr, 400, error_string);
safefree(error_string);
goto COMMON_EXIT;