From: Matt Caswell Date: Tue, 11 Aug 2015 18:38:39 +0000 (+0100) Subject: Fix "make test" seg fault with SCTP enabled X-Git-Tag: OpenSSL_1_0_1q~102 X-Git-Url: https://git.openssl.org/?p=openssl.git;a=commitdiff_plain;h=396e30044910df29b81a416de42a94eb4355cd70;hp=402634f8aaf2f2c83b2cc648a0ae376247b029f4;ds=sidebyside Fix "make test" seg fault with SCTP enabled When config'd with "sctp" running "make test" causes a seg fault. This is actually due to the way ssltest works - it dives under the covers and frees up BIOs manually and so some BIOs are NULL when the SCTP code does not expect it. The simplest fix is just to add some sanity checks to make sure the BIOs aren't NULL before we use them. This problem occurs in master and 1.0.2. The fix has also been applied to 1.0.1 to keep the code in sync. Reviewed-by: Tim Hudson (cherry picked from commit f75d5171be0b3b5419c8974133e1573cf976a8bb) --- diff --git a/ssl/d1_both.c b/ssl/d1_both.c index 8dd8ea33ca..d453c07c8e 100644 --- a/ssl/d1_both.c +++ b/ssl/d1_both.c @@ -1490,9 +1490,12 @@ int dtls1_shutdown(SSL *s) { int ret; #ifndef OPENSSL_NO_SCTP - if (BIO_dgram_is_sctp(SSL_get_wbio(s)) && + BIO *wbio; + + wbio = SSL_get_wbio(s); + if (wbio != NULL && BIO_dgram_is_sctp(wbio) && !(s->shutdown & SSL_SENT_SHUTDOWN)) { - ret = BIO_dgram_sctp_wait_for_dry(SSL_get_wbio(s)); + ret = BIO_dgram_sctp_wait_for_dry(wbio); if (ret < 0) return -1;