diff options
author | Riza Sulistyo <riza@teluu.com> | 2015-01-05 04:34:17 +0000 |
---|---|---|
committer | Riza Sulistyo <riza@teluu.com> | 2015-01-05 04:34:17 +0000 |
commit | 61c0fc6417c175c88155f44183e66c8fbb7652e4 (patch) | |
tree | f5724c816a1d9f6695e084c7f795c42ca09c5cac /pjlib/src | |
parent | 374f998f28d471c6f2daeb55c9a9c1ae8914c128 (diff) |
Re #1782 (misc): Change assert check of ssl_state to non assert check on OpenSSL wrapper implementation.
(thanks to Joshua Colp for the suggestion)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4972 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src')
-rw-r--r-- | pjlib/src/pj/ssl_sock_ossl.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/pjlib/src/pj/ssl_sock_ossl.c b/pjlib/src/pj/ssl_sock_ossl.c index e4013e2e..887b939a 100644 --- a/pjlib/src/pj/ssl_sock_ossl.c +++ b/pjlib/src/pj/ssl_sock_ossl.c @@ -2217,7 +2217,9 @@ PJ_DEF(pj_status_t) pj_ssl_sock_start_read (pj_ssl_sock_t *ssock, unsigned i; PJ_ASSERT_RETURN(ssock && pool && buff_size, PJ_EINVAL); - PJ_ASSERT_RETURN(ssock->ssl_state==SSL_STATE_ESTABLISHED, PJ_EINVALIDOP); + + if (ssock->ssl_state != SSL_STATE_ESTABLISHED) + return PJ_EINVALIDOP; readbuf = (void**) pj_pool_calloc(pool, ssock->param.async_cnt, sizeof(void*)); @@ -2245,7 +2247,9 @@ PJ_DEF(pj_status_t) pj_ssl_sock_start_read2 (pj_ssl_sock_t *ssock, unsigned i; PJ_ASSERT_RETURN(ssock && pool && buff_size && readbuf, PJ_EINVAL); - PJ_ASSERT_RETURN(ssock->ssl_state==SSL_STATE_ESTABLISHED, PJ_EINVALIDOP); + + if (ssock->ssl_state != SSL_STATE_ESTABLISHED) + return PJ_EINVALIDOP; /* Create SSL socket read buffer */ ssock->ssock_rbuf = (read_data_t*)pj_pool_calloc(pool, @@ -2450,7 +2454,9 @@ PJ_DEF(pj_status_t) pj_ssl_sock_send (pj_ssl_sock_t *ssock, pj_status_t status; PJ_ASSERT_RETURN(ssock && data && size && (*size>0), PJ_EINVAL); - PJ_ASSERT_RETURN(ssock->ssl_state==SSL_STATE_ESTABLISHED, PJ_EINVALIDOP); + + if (ssock->ssl_state != SSL_STATE_ESTABLISHED) + return PJ_EINVALIDOP; // Ticket #1573: Don't hold mutex while calling PJLIB socket send(). //pj_lock_acquire(ssock->write_mutex); @@ -2725,7 +2731,10 @@ PJ_DEF(pj_status_t) pj_ssl_sock_renegotiate(pj_ssl_sock_t *ssock) int ret; pj_status_t status; - PJ_ASSERT_RETURN(ssock->ssl_state == SSL_STATE_ESTABLISHED, PJ_EINVALIDOP); + PJ_ASSERT_RETURN(ssock, PJ_EINVAL); + + if (ssock->ssl_state != SSL_STATE_ESTABLISHED) + return PJ_EINVALIDOP; if (SSL_renegotiate_pending(ssock->ossl_ssl)) return PJ_EPENDING; |