diff options
author | Robert James Kaes <rjkaes@users.sourceforge.net> | 2000-03-28 16:19:12 +0000 |
---|---|---|
committer | Robert James Kaes <rjkaes@users.sourceforge.net> | 2000-03-28 16:19:12 +0000 |
commit | d222c7725bbaabaa8e0d62a48bd167cd8ec28f29 (patch) | |
tree | ca5edc9ffde531fdc24af1b8d4bbcf8993b59b09 /src | |
parent | c2ef08202b03bcc07e700585e29e943716734ce4 (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.c | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -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; |