Skip to content

Commit

Permalink
Merge pull request #174 from jsparber/allow_undefined_length
Browse files Browse the repository at this point in the history
sdp_parse.c: allow msgsize = -1 in sdp_parse() arguments
  • Loading branch information
andywolk authored Sep 22, 2022
2 parents 2a3bf7e + 86be064 commit 818ed2e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions libsofia-sip-ua/sdp/sdp_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,12 @@ static int parsing_error(sdp_parser_t *p, char const *fmt, ...);
/** Parse an SDP message.
*
* The function sdp_parse() parses an SDP message @a msg of size @a
* msgsize. Parsing is done according to the given @a flags. The SDP message
* may not contain a NUL.
* msgsize. If msgsize is -1, the size of message is calculated using
* strlen().
*
* Parsing is done according to the given @a flags.
*
* The SDP message may not contain a NUL.
*
* The parsing result is stored to an #sdp_session_t structure.
*
Expand Down Expand Up @@ -147,7 +151,7 @@ sdp_parse(su_home_t *home, char const msg[], issize_t msgsize, int flags)
char *b;
size_t len;

if (msgsize == -1 || msg == NULL) {
if (msg == NULL) {
p = su_home_clone(home, sizeof(*p));
if (p)
parsing_error(p, "invalid input message");
Expand All @@ -156,7 +160,7 @@ sdp_parse(su_home_t *home, char const msg[], issize_t msgsize, int flags)
return p;
}

if (msgsize == -1 && msg)
if (msgsize == -1)
len = strlen(msg);
else
len = msgsize;
Expand Down

0 comments on commit 818ed2e

Please sign in to comment.