[project @ 2004-04-10 18:42:37 by jmb]

Fix bug in sanity checking code

svn path=/import/netsurf/; revision=745
This commit is contained in:
John Mark Bell 2004-04-10 18:42:37 +00:00
parent f61d7fe881
commit 82b4ac72df
1 changed files with 7 additions and 2 deletions

View File

@ -68,6 +68,7 @@ void login_list_add(char *host, char* logindets) {
/**
* Retrieves an element from the login list
*/
/** \todo Make the matching spec compliant (see RFC 2617) */
struct login *login_list_get(char *url) {
struct login *nli;
@ -83,7 +84,8 @@ struct login *login_list_get(char *url) {
return NULL;
host = url_host(url);
assert(host != 0);
if (host == 0 || strlen(host) == 0) return NULL;
temp = xstrdup(url);
/* Smallest thing to check for is the scheme + host name + trailing '/'
@ -92,7 +94,10 @@ struct login *login_list_get(char *url) {
if (strlen(host) > strlen(temp)) {
xfree(temp);
temp = url_host(url);
assert(temp != 0);
if (temp == 0 || strlen(temp) == 0) {
xfree(host);
return NULL;
}
}
xfree(host);