diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2011-10-31 22:17:05 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2011-10-31 22:17:05 +0000 |
commit | a4dc04e44a993e109eb7db7a8a9fc05c41ec7cc3 (patch) | |
tree | 164d78ed3430b5af1f3b18b3266ae49134358ec6 /utils | |
parent | d64e09aef78d843d347def76a1f1104c0efc1db0 (diff) | |
download | netsurf-a4dc04e44a993e109eb7db7a8a9fc05c41ec7cc3.tar.gz netsurf-a4dc04e44a993e109eb7db7a8a9fc05c41ec7cc3.tar.bz2 |
Test numbers before calling strncmp.
svn path=/trunk/netsurf/; revision=13107
Diffstat (limited to 'utils')
-rw-r--r-- | utils/nsurl.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/utils/nsurl.c b/utils/nsurl.c index 61799e64c..306f442b6 100644 --- a/utils/nsurl.c +++ b/utils/nsurl.c @@ -853,14 +853,13 @@ static nserror nsurl__create_from_section(const char const *url_s, 1 : 0; sec_start = norm_start + colon - pegs->at + skip; - if (url->scheme != NULL && - strncmp(lwc_string_data( - url->scheme), "http", - SLEN("http")) == 0 && - length - + if (url->scheme != NULL && length - (colon - pegs->at + 1) == 2 && *sec_start == '8' && - *(sec_start + 1) == '0') { + *(sec_start + 1) == '0' && + strncmp(lwc_string_data( + url->scheme), "http", + SLEN("http")) == 0) { /* Scheme is http, and port is default * (80) */ flags |= NSURL_F_NO_PORT; |