Skip to content

Commit

Permalink
core: parse uri - check for invalid port values
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Apr 3, 2021
1 parent 9413fc6 commit b7f753d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/core/config.h
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions src/core/parser/parse_uri.c
Expand Up @@ -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 \
Expand Down

0 comments on commit b7f753d

Please sign in to comment.