forked from wolfSSL/wolfssl
Merge pull request #330 from kaleb-himes/CID-66007-coverity
avoid dereference of null pointer if args is null
This commit is contained in:
@@ -834,6 +834,9 @@ static INLINE void tcp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd,
|
|||||||
{
|
{
|
||||||
SOCKADDR_IN_T client;
|
SOCKADDR_IN_T client;
|
||||||
socklen_t client_len = sizeof(client);
|
socklen_t client_len = sizeof(client);
|
||||||
|
tcp_ready* ready = NULL;
|
||||||
|
|
||||||
|
(void) ready; /* Account for case when "ready" is not used */
|
||||||
|
|
||||||
if (udp) {
|
if (udp) {
|
||||||
udp_accept(sockfd, clientfd, useAnyAddr, port, args);
|
udp_accept(sockfd, clientfd, useAnyAddr, port, args);
|
||||||
@@ -845,8 +848,8 @@ static INLINE void tcp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd,
|
|||||||
|
|
||||||
#if defined(_POSIX_THREADS) && defined(NO_MAIN_DRIVER) && !defined(__MINGW32__)
|
#if defined(_POSIX_THREADS) && defined(NO_MAIN_DRIVER) && !defined(__MINGW32__)
|
||||||
/* signal ready to tcp_accept */
|
/* signal ready to tcp_accept */
|
||||||
{
|
if (args)
|
||||||
tcp_ready* ready = args->signal;
|
ready = args->signal;
|
||||||
if (ready) {
|
if (ready) {
|
||||||
pthread_mutex_lock(&ready->mutex);
|
pthread_mutex_lock(&ready->mutex);
|
||||||
ready->ready = 1;
|
ready->ready = 1;
|
||||||
@@ -854,18 +857,21 @@ static INLINE void tcp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd,
|
|||||||
pthread_cond_signal(&ready->cond);
|
pthread_cond_signal(&ready->cond);
|
||||||
pthread_mutex_unlock(&ready->mutex);
|
pthread_mutex_unlock(&ready->mutex);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#elif defined (WOLFSSL_TIRTOS)
|
#elif defined (WOLFSSL_TIRTOS)
|
||||||
/* Need mutex? */
|
/* Need mutex? */
|
||||||
tcp_ready* ready = args->signal;
|
if (args)
|
||||||
|
ready = args->signal;
|
||||||
|
if (ready) {
|
||||||
ready->ready = 1;
|
ready->ready = 1;
|
||||||
ready->port = port;
|
ready->port = port;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ready_file) {
|
if (ready_file) {
|
||||||
#ifndef NO_FILESYSTEM
|
#ifndef NO_FILESYSTEM
|
||||||
FILE* srf = NULL;
|
FILE* srf = NULL;
|
||||||
tcp_ready* ready = args ? args->signal : NULL;
|
if (args)
|
||||||
|
ready = args->signal;
|
||||||
|
|
||||||
if (ready) {
|
if (ready) {
|
||||||
srf = fopen(ready->srfName, "w");
|
srf = fopen(ready->srfName, "w");
|
||||||
|
Reference in New Issue
Block a user