From 82b4ac72dfd41b0bf0d51cfcf0447efc409a6824 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sat, 10 Apr 2004 18:42:37 +0000 Subject: [project @ 2004-04-10 18:42:37 by jmb] Fix bug in sanity checking code svn path=/import/netsurf/; revision=745 --- desktop/loginlist.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'desktop/loginlist.c') diff --git a/desktop/loginlist.c b/desktop/loginlist.c index 3dc7be0da..1baab81ac 100644 --- a/desktop/loginlist.c +++ b/desktop/loginlist.c @@ -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); -- cgit v1.2.3