diff options
author | Benny Prijono <bennylp@teluu.com> | 2006-02-02 21:14:29 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2006-02-02 21:14:29 +0000 |
commit | ecb6949ce990a0ddf2a2e73a7113baae5253143c (patch) | |
tree | bb26355320b8a2eed948c5cd63538d6d10e45b84 | |
parent | 5125fc4191998ab13529ee59706f95116fc1725a (diff) |
Added more asserts
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@130 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r-- | pjsip/src/pjsip/sip_transaction.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/pjsip/src/pjsip/sip_transaction.c b/pjsip/src/pjsip/sip_transaction.c index 39bc8d20..cf07ddf0 100644 --- a/pjsip/src/pjsip/sip_transaction.c +++ b/pjsip/src/pjsip/sip_transaction.c @@ -974,7 +974,14 @@ PJ_DEF(pj_status_t) pjsip_tsx_create_uac( pjsip_module *tsx_user, struct tsx_lock_data lck; pj_status_t status; - PJ_ASSERT_RETURN(tdata!=NULL && p_tsx!=NULL, PJ_EINVAL); + /* Validate arguments. */ + PJ_ASSERT_RETURN(tdata && tdata->msg && p_tsx, PJ_EINVAL); + PJ_ASSERT_RETURN(tdata->msg->type == PJSIP_REQUEST_MSG, + PJSIP_ENOTREQUESTMSG); + + /* Method MUST NOT be ACK! */ + PJ_ASSERT_RETURN(tdata->msg->line.req.method.id != PJSIP_ACK_METHOD, + PJ_EINVALIDOP); /* Keep shortcut */ msg = tdata->msg; @@ -1097,7 +1104,8 @@ PJ_DEF(pj_status_t) pjsip_tsx_create_uas( pjsip_module *tsx_user, pj_status_t status; struct tsx_lock_data lck; - PJ_ASSERT_RETURN(rdata!=NULL && p_tsx!=NULL, PJ_EINVAL); + /* Validate arguments. */ + PJ_ASSERT_RETURN(rdata && rdata->msg_info.msg && p_tsx, PJ_EINVAL); /* Keep shortcut to message */ msg = rdata->msg_info.msg; @@ -1105,6 +1113,10 @@ PJ_DEF(pj_status_t) pjsip_tsx_create_uas( pjsip_module *tsx_user, /* Make sure this is a request message. */ PJ_ASSERT_RETURN(msg->type == PJSIP_REQUEST_MSG, PJSIP_ENOTREQUESTMSG); + /* Make sure method is not ACK */ + PJ_ASSERT_RETURN(msg->line.req.method.id != PJSIP_ACK_METHOD, + PJ_EINVALIDOP); + /* Make sure CSeq header is present. */ cseq = rdata->msg_info.cseq; if (!cseq) |