From a91c7cdf04436af33aa6e8656889add097ca15e8 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Fri, 9 Sep 2016 08:45:28 +0100 Subject: [PATCH] make urldb parsing of ascii data explicit --- content/urldb.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/content/urldb.c b/content/urldb.c index 8c2a3ae04..b27e23c17 100644 --- a/content/urldb.c +++ b/content/urldb.c @@ -88,7 +88,6 @@ */ #include -#include #include #include #include @@ -105,6 +104,7 @@ #include "utils/bloom.h" #include "utils/time.h" #include "utils/nsurl.h" +#include "utils/ascii.h" #include "netsurf/bitmap.h" #include "desktop/cookie_manager.h" #include "desktop/gui_internal.h" @@ -1023,10 +1023,11 @@ static struct search_node **urldb_get_search_tree_direct(const char *host) { assert(host); - if (urldb__host_is_ip_address(host)) + if (urldb__host_is_ip_address(host)) { return &search_trees[ST_IP]; - else if (isalpha(*host)) - return &search_trees[ST_DN + tolower(*host) - 'a']; + } else if (ascii_is_alpha(*host)) { + return &search_trees[ST_DN + ascii_to_lower(*host) - 'a']; + } return &search_trees[ST_EE]; } @@ -1607,9 +1608,11 @@ static bool urldb_parse_avpair(struct cookie_internal_data *c, char *n, /* Strip dayname from date (these are hugely variable * and liable to break the parser. They also serve no * useful purpose) */ - for (datenoday = v; *datenoday && !isdigit(*datenoday); - datenoday++) - ; /* do nothing */ + for (datenoday = v; + *datenoday && !ascii_is_digit(*datenoday); + datenoday++) { + /* do nothing */ + } res = nsc_strntimet(datenoday, strlen(datenoday), &expires); if (res != NSERROR_OK) {