Module: kamailio Branch: master Commit: b7f753ddc727e1d7ab42e7abe607059e03976f8d URL: https://github.com/kamailio/kamailio/commit/b7f753ddc727e1d7ab42e7abe607059e...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2021-04-03T07:55:11+02:00
core: parse uri - check for invalid port values
---
Modified: src/core/config.h Modified: src/core/parser/parse_uri.c
---
Diff: https://github.com/kamailio/kamailio/commit/b7f753ddc727e1d7ab42e7abe607059e... Patch: https://github.com/kamailio/kamailio/commit/b7f753ddc727e1d7ab42e7abe607059e...
---
diff --git a/src/core/config.h b/src/core/config.h index e54413b5bc..e012e98edf 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -96,6 +96,7 @@ #define MY_BRANCH ";branch=" #define MY_BRANCH_LEN (sizeof(MY_BRANCH) - 1)
+#define MAX_PORT_VAL 65535 #define MAX_PORT_LEN 7 /* ':' + max 5 letters + \0 */
#define CRLF "\r\n" diff --git a/src/core/parser/parse_uri.c b/src/core/parser/parse_uri.c index 2c24054d2c..19f6f2e02a 100644 --- a/src/core/parser/parse_uri.c +++ b/src/core/parser/parse_uri.c @@ -143,6 +143,9 @@ int parse_uri(char* buf, int len, struct sip_uri* uri) #define case_port( ch, var) \ case ch: \ (var)=(var)*10+ch-'0'; \ + if((var) > MAX_PORT_VAL) { \ + goto error_bad_port; \ + }\ break
#define still_at_user \