diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2006-06-14 21:47:23 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2006-06-14 21:47:23 +0000 |
commit | 217e59aebefb1a0a17fd713a8e38c2563cda8c8c (patch) | |
tree | d6e5829608b7685eb9bdf6a3e3329f70b240b224 /content | |
parent | d44108433e2cc746f7b84c0e266632ab6cfb3aea (diff) | |
download | netsurf-217e59aebefb1a0a17fd713a8e38c2563cda8c8c.tar.gz netsurf-217e59aebefb1a0a17fd713a8e38c2563cda8c8c.tar.bz2 |
Fix off-by-one error in search routines which caused crashes with
(invalid) host names ending in a '.'.
svn path=/trunk/netsurf/; revision=2618
Diffstat (limited to 'content')
-rw-r--r-- | content/urldb.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/content/urldb.c b/content/urldb.c index e9bbb9012..f150aeb25 100644 --- a/content/urldb.c +++ b/content/urldb.c @@ -2056,13 +2056,13 @@ int urldb_search_match_string(const struct host_part *a, return strcasecmp(a->part, b); } - end = b + strlen(b); + end = b + strlen(b) + 1; while (b < end && a && a != &db_root) { dot = strchr(b, '.'); if (!dot) { /* last segment */ - dot = end; + dot = end - 1; } /* Compare strings (length limited) */ @@ -2119,13 +2119,13 @@ int urldb_search_match_prefix(const struct host_part *a, return strncasecmp(a->part, b, strlen(b)); } - end = b + strlen(b); + end = b + strlen(b) + 1; while (b < end && a && a != &db_root) { dot = strchr(b, '.'); if (!dot) { /* last segment */ - dot = end; + dot = end - 1; } /* Compare strings (length limited) */ @@ -2134,7 +2134,7 @@ int urldb_search_match_prefix(const struct host_part *a, return ret; /* The strings matched */ - if (dot < end) { + if (dot < end - 1) { /* Consider segment lengths only in the case * where the prefix contains segments */ plen = strlen(a->part); |