Fix possible NULL dereferencial.

Notified by Verdon Walker <VWalker@novell.com>
This commit is contained in:
Richard Levitte 2003-01-16 06:00:59 +00:00
parent dd1a3c26ba
commit bc35d57932

View File

@ -1069,7 +1069,9 @@ int ssl_cipher_ptr_id_cmp(const SSL_CIPHER * const *ap,
* preference */ * preference */
STACK_OF(SSL_CIPHER) *SSL_get_ciphers(SSL *s) STACK_OF(SSL_CIPHER) *SSL_get_ciphers(SSL *s)
{ {
if ((s != NULL) && (s->cipher_list != NULL)) if (s != NULL)
{
if (s->cipher_list != NULL)
{ {
return(s->cipher_list); return(s->cipher_list);
} }
@ -1078,6 +1080,7 @@ STACK_OF(SSL_CIPHER) *SSL_get_ciphers(SSL *s)
{ {
return(s->ctx->cipher_list); return(s->ctx->cipher_list);
} }
}
return(NULL); return(NULL);
} }
@ -1085,15 +1088,18 @@ STACK_OF(SSL_CIPHER) *SSL_get_ciphers(SSL *s)
* algorithm id */ * algorithm id */
STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s) STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s)
{ {
if ((s != NULL) && (s->cipher_list_by_id != NULL)) if (s != NULL)
{
if (s->cipher_list_by_id != NULL)
{ {
return(s->cipher_list_by_id); return(s->cipher_list_by_id);
} }
else if ((s != NULL) && (s->ctx != NULL) && else if ((s->ctx != NULL) &&
(s->ctx->cipher_list_by_id != NULL)) (s->ctx->cipher_list_by_id != NULL))
{ {
return(s->ctx->cipher_list_by_id); return(s->ctx->cipher_list_by_id);
} }
}
return(NULL); return(NULL);
} }