Module: kamailio
Branch: master
Commit: 4994960324d5353222b3de08515bed07802ab7bc
URL:
https://github.com/kamailio/kamailio/commit/4994960324d5353222b3de08515bed0…
Author: Juha Heinanen <jh(a)tutpro.com>
Committer: Juha Heinanen <jh(a)tutpro.com>
Date: 2018-01-10T08:39:48+02:00
core/parser: more strict parsing of sip uri host
---
Modified: src/core/parser/parse_uri.c
---
Diff:
https://github.com/kamailio/kamailio/commit/4994960324d5353222b3de08515bed0…
Patch:
https://github.com/kamailio/kamailio/commit/4994960324d5353222b3de08515bed0…
---
diff --git a/src/core/parser/parse_uri.c b/src/core/parser/parse_uri.c
index af03b92f0d..dbf5a7f9f7 100644
--- a/src/core/parser/parse_uri.c
+++ b/src/core/parser/parse_uri.c
@@ -528,23 +528,23 @@ int parse_uri(char* buf, int len, struct sip_uri* uri)
}
break;
case URI_HOST:
- switch(*p){
- case '[':
- state=URI_HOST6_P;
- break;
- case ':':
- case ';':
- case '?': /* null host name ->invalid */
- case '&':
- case '@': /*chars not allowed in hosts names */
+ if(*p == '[') {
+ state = URI_HOST6_P;
+ } else {
+ if(isalnum(*p)) {
+ state = URI_HOST_P;
+ } else {
goto error_bad_host;
- default:
- state=URI_HOST_P;
+ }
}
break;
case URI_HOST_P:
- switch(*p){
+ switch(*p) {
check_host_end;
+ default:
+ if(!isalnum(*p) && (*p != '.') && (*p != '-')) {
+ goto error_bad_host;
+ }
}
break;
case URI_HOST6_END: