From a4dc04e44a993e109eb7db7a8a9fc05c41ec7cc3 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 31 Oct 2011 22:17:05 +0000 Subject: Test numbers before calling strncmp. svn path=/trunk/netsurf/; revision=13107 --- utils/nsurl.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'utils/nsurl.c') 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; -- cgit v1.2.3