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.
This commit is contained in:
parent
c2ef08202b
commit
d222c7725b
17
src/reqs.c
17
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;
|
||||
|
Loading…
Reference in New Issue
Block a user