From: Frédéric Marchal Date: Sat, 2 Jul 2011 19:49:23 +0000 (+0000) Subject: Stop parsing the URL at the parameters X-Git-Tag: v2.3.2~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84aefd39b01086d8c48454786b873fc2c4b70ced;p=thirdparty%2Fsarg.git Stop parsing the URL at the parameters The end of a host name is marked by a / for a path or a ? for parameters. Both must end the host name. --- diff --git a/url.c b/url.c index 5545ccc..3d7ada5 100644 --- a/url.c +++ b/url.c @@ -595,8 +595,8 @@ const char *process_url(char *url,bool full_url) start=url; if (!full_url) { - for (str=url ; *str && *str!='/' ; str++); - if (*str=='/') *str='\0'; + for (str=url ; *str && *str!='/' && *str!='?' ; str++); + *str='\0'; type=extract_address_mask(url,&address,ipv4,ipv6,NULL,&next); if (type==1) { if (FirstAliasName) diff --git a/util.c b/util.c index 6b52b03..b5cb4b5 100644 --- a/util.c +++ b/util.c @@ -1814,7 +1814,7 @@ int extract_address_mask(char *buf,char **text,unsigned char *ipv4,unsigned shor addr_len=0; nibble6_len=0; pad_pos=-1; - for (i=0 ; (unsigned char)buf[i]>' ' && buf[i]!='/' && (!bracket || buf[i]!=']') && ip_size ; i++) { + for (i=0 ; (unsigned char)buf[i]>' ' && buf[i]!='/' && buf[i]!='?' && (!bracket || buf[i]!=']') && ip_size ; i++) { if (ip_size & 0x04) { if (isdigit(buf[i])) { value4=value4*10+(buf[i]-'0');