diff options
author | Kenny Root <kroot@google.com> | 2013-05-29 19:40:16 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2013-05-29 19:40:17 +0000 |
commit | 40630ebf13e02c9ce1121584c84b3c2e4251a822 (patch) | |
tree | a33edd150c3f477b86083ff8c815eb2bef9ac474 | |
parent | c741f1470f61f0d436d159edfc673d270b89857e (diff) | |
parent | 83c16bcb5eb3e6c0ad18a620912ecdf3a401e6a3 (diff) | |
download | libcore-40630ebf13e02c9ce1121584c84b3c2e4251a822.zip libcore-40630ebf13e02c9ce1121584c84b3c2e4251a822.tar.gz libcore-40630ebf13e02c9ce1121584c84b3c2e4251a822.tar.bz2 |
Merge "NativeCrypto: check that npnProtocols != NULL"
-rw-r--r-- | crypto/src/main/native/org_conscrypt_NativeCrypto.cpp | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/crypto/src/main/native/org_conscrypt_NativeCrypto.cpp b/crypto/src/main/native/org_conscrypt_NativeCrypto.cpp index c6c830f..6013681 100644 --- a/crypto/src/main/native/org_conscrypt_NativeCrypto.cpp +++ b/crypto/src/main/native/org_conscrypt_NativeCrypto.cpp @@ -6740,20 +6740,25 @@ static int next_proto_select_callback(SSL* ssl, unsigned char **out, unsigned ch AppData* appData = toAppData(ssl); JNI_TRACE("AppData=%p", appData); unsigned char* npnProtocols = reinterpret_cast<unsigned char*>(appData->npnProtocolsData); - size_t npnProtocolsLength = appData->npnProtocolsLength; - JNI_TRACE("npn_protocols=%p, length=%d", npnProtocols, npnProtocolsLength); - - int status = SSL_select_next_proto(out, outlen, in, inlen, npnProtocols, npnProtocolsLength); - switch (status) { - case OPENSSL_NPN_NEGOTIATED: - JNI_TRACE("ssl=%p next_proto_select_callback NPN negotiated", ssl); - break; - case OPENSSL_NPN_UNSUPPORTED: - JNI_TRACE("ssl=%p next_proto_select_callback NPN unsupported", ssl); - break; - case OPENSSL_NPN_NO_OVERLAP: - JNI_TRACE("ssl=%p next_proto_select_callback NPN no overlap", ssl); - break; + if (npnProtocols != NULL) { + size_t npnProtocolsLength = appData->npnProtocolsLength; + JNI_TRACE("npn_protocols=%p, length=%d", npnProtocols, npnProtocolsLength); + + int status = SSL_select_next_proto(out, outlen, in, inlen, npnProtocols, + npnProtocolsLength); + switch (status) { + case OPENSSL_NPN_NEGOTIATED: + JNI_TRACE("ssl=%p next_proto_select_callback NPN negotiated", ssl); + break; + case OPENSSL_NPN_UNSUPPORTED: + JNI_TRACE("ssl=%p next_proto_select_callback NPN unsupported", ssl); + break; + case OPENSSL_NPN_NO_OVERLAP: + JNI_TRACE("ssl=%p next_proto_select_callback NPN no overlap", ssl); + break; + } + } else { + JNI_TRACE("npn_protocols=NULL"); } return SSL_TLSEXT_ERR_OK; } |