Skip to content

Commit 818ed2e

Browse files
authored
Merge pull request #174 from jsparber/allow_undefined_length
sdp_parse.c: allow msgsize = -1 in sdp_parse() arguments
2 parents 2a3bf7e + 86be064 commit 818ed2e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

libsofia-sip-ua/sdp/sdp_parse.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,12 @@ static int parsing_error(sdp_parser_t *p, char const *fmt, ...);
110110
/** Parse an SDP message.
111111
*
112112
* The function sdp_parse() parses an SDP message @a msg of size @a
113-
* msgsize. Parsing is done according to the given @a flags. The SDP message
114-
* may not contain a NUL.
113+
* msgsize. If msgsize is -1, the size of message is calculated using
114+
* strlen().
115+
*
116+
* Parsing is done according to the given @a flags.
117+
*
118+
* The SDP message may not contain a NUL.
115119
*
116120
* The parsing result is stored to an #sdp_session_t structure.
117121
*
@@ -147,7 +151,7 @@ sdp_parse(su_home_t *home, char const msg[], issize_t msgsize, int flags)
147151
char *b;
148152
size_t len;
149153

150-
if (msgsize == -1 || msg == NULL) {
154+
if (msg == NULL) {
151155
p = su_home_clone(home, sizeof(*p));
152156
if (p)
153157
parsing_error(p, "invalid input message");
@@ -156,7 +160,7 @@ sdp_parse(su_home_t *home, char const msg[], issize_t msgsize, int flags)
156160
return p;
157161
}
158162

159-
if (msgsize == -1 && msg)
163+
if (msgsize == -1)
160164
len = strlen(msg);
161165
else
162166
len = msgsize;

0 commit comments

Comments
 (0)