Module: kamailio
Branch: master
Commit: eda4b3c51ce12d4fe052b7e9ad40be1ef6e56444
URL:
https://github.com/kamailio/kamailio/commit/eda4b3c51ce12d4fe052b7e9ad40be1…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-03-15T10:11:09+01:00
core: parse uri - sanity check for user part
---
Modified: src/core/parser/parse_uri.c
---
Diff:
https://github.com/kamailio/kamailio/commit/eda4b3c51ce12d4fe052b7e9ad40be1…
Patch:
https://github.com/kamailio/kamailio/commit/eda4b3c51ce12d4fe052b7e9ad40be1…
---
diff --git a/src/core/parser/parse_uri.c b/src/core/parser/parse_uri.c
index 6cbf22a7c7..8f7a53f77b 100644
--- a/src/core/parser/parse_uri.c
+++ b/src/core/parser/parse_uri.c
@@ -1236,8 +1236,16 @@ int parse_uri(char* buf, int len, struct sip_uri* uri)
break; /* do nothing, avoids a compilation warning */
}
- if(uri->port.len>5)
+ /* common sanity checks */
+ if(uri->port.len>5) {
+ /* port value to large */
goto error_invalid_port;
+ }
+ if(uri->host.len>0 && uri->host.s>buf &&
*(uri->host.s-1)=='@'
+ && uri->user.len<=0) {
+ /* '@' before host, but no user part */
+ goto error_bad_uri;
+ }
#ifdef EXTRA_DEBUG
/* do stuff */