Module: sems Branch: master Commit: fb87bb0e706335716aec37ce465cdf0aa259478e URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=fb87bb0e706335716aec37ce465cdf0aa259478e
Author: Stefan Sayer <[email protected]> Committer: Stefan Sayer <[email protected]> Date: Fri May 6 19:21:05 2011 +0200 b/f: process properly on short SDP --- core/AmSdp.cpp | 33 ++++++++++++++++++++++----------- 1 files changed, 22 insertions(+), 11 deletions(-) diff --git a/core/AmSdp.cpp b/core/AmSdp.cpp index 8270f46..90bb64b 100644 --- a/core/AmSdp.cpp +++ b/core/AmSdp.cpp @@ -490,9 +490,11 @@ static bool parse_sdp_line_ex(AmSdp* sdp_msg, char*& s) { s = is_eql_next(s); next = get_next_line(s); - string version(s, int(next-s)-2); - str2i(version, sdp_msg->version); - DBG("parse_sdp_line_ex: found version\n"); + if (int(next-s)-2 >= 0) { + string version(s, int(next-s)-2); + str2i(version, sdp_msg->version); + DBG("parse_sdp_line_ex: found version\n"); + } s = next; state = SDP_DESCR; break; @@ -510,8 +512,10 @@ static bool parse_sdp_line_ex(AmSdp* sdp_msg, char*& s) DBG("parse_sdp_line_ex: found session\n"); s = is_eql_next(s); next = get_next_line(s); - string sessionName(s, int(next-s)-2); - sdp_msg->sessionName = sessionName; + if (int(next-s)-2 >= 0) { + string sessionName(s, int(next-s)-2); + sdp_msg->sessionName = sessionName; + } s = next; break; } @@ -520,7 +524,9 @@ static bool parse_sdp_line_ex(AmSdp* sdp_msg, char*& s) DBG("parse_sdp_line_ex: found uri\n"); s = is_eql_next(s); next = get_next_line(s); - sdp_msg->uri = string(s, int(next-s)-2); + if (int(next-s)-2 >= 0) { + sdp_msg->uri = string(s, int(next-s)-2); + } s = next; } break; @@ -560,8 +566,11 @@ static bool parse_sdp_line_ex(AmSdp* sdp_msg, char*& s) default: { next = get_next_line(s); - string line(s, int(next-s)-2); - DBG("parse_sdp_line: skipping unknown Session description %s=\n", (char*)line.c_str()); + if (int(next-s)-2 >= 0) { + string line(s, int(next-s)-2); + DBG("parse_sdp_line: skipping unknown Session description %s=\n", + (char*)line.c_str()); + } s = next; break; } @@ -608,9 +617,11 @@ static bool parse_sdp_line_ex(AmSdp* sdp_msg, char*& s) default : { next = get_next_line(s); - string line(s, int(next-s)-2); - DBG("parse_sdp_line: skipping unknown Media description '%s'\n", - (char*)line.c_str()); + if (int(next-s)-2 >= 0) { + string line(s, int(next-s)-2); + DBG("parse_sdp_line: skipping unknown Media description '%s'\n", + (char*)line.c_str()); + } s = next; break; } _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
