summaryrefslogtreecommitdiff
path: root/content/urldb.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2006-04-15 13:59:53 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2006-04-15 13:59:53 +0000
commit5873160a8b72a61de0319ee789ce008a4ace403e (patch)
treeeb0b223e0b820e9b0bb42ef17caeeff4d1751176 /content/urldb.c
parent3e54aab0d561a071ca6d42de617f688533d33b0c (diff)
downloadnetsurf-5873160a8b72a61de0319ee789ce008a4ace403e.tar.gz
netsurf-5873160a8b72a61de0319ee789ce008a4ace403e.tar.bz2
Fix undersized buffer for reading port number into
Detect no URLs for a host before adding host to database. svn path=/trunk/netsurf/; revision=2530
Diffstat (limited to 'content/urldb.c')
-rw-r--r--content/urldb.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/content/urldb.c b/content/urldb.c
index 5a0260405..96a0ee67f 100644
--- a/content/urldb.c
+++ b/content/urldb.c
@@ -312,14 +312,21 @@ void urldb_load(const char *filename)
}
}
- h = urldb_add_host(host);
- if (!h)
- die("Memory exhausted whilst loading URL file");
-
+ /* read number of URLs */
if (!fgets(s, MAXIMUM_URL_LENGTH, fp))
break;
urls = atoi(s);
+ /* no URLs => try next host */
+ if (urls == 0) {
+ LOG(("No URLs for '%s'", host));
+ continue;
+ }
+
+ h = urldb_add_host(host);
+ if (!h)
+ die("Memory exhausted whilst loading URL file");
+
/* load the non-corrupt data */
for (i = 0; i < urls; i++) {
struct path_data *p = NULL;
@@ -354,7 +361,7 @@ void urldb_load(const char *filename)
p = urldb_find_url(s);
}
} else {
- char scheme[64], ports[6];
+ char scheme[64], ports[10];
char url[64 + 3 + 256 + 6 + 4096 + 1];
unsigned int port;
bool is_file = false;