GNUTLS: Avoid null derefence in constructing ciphersuite
This commit is contained in:
parent
897c10749d
commit
06feeb244d
1 changed files with 21 additions and 5 deletions
|
@ -673,12 +673,28 @@ rb_ssl_get_cipher(rb_fde_t *F)
|
||||||
{
|
{
|
||||||
static char buf[1024];
|
static char buf[1024];
|
||||||
|
|
||||||
rb_snprintf(buf, sizeof(buf), "%s-%s-%s-%s",
|
const char* proto_name =
|
||||||
gnutls_protocol_get_name(gnutls_protocol_get_version(SSL_P(F))),
|
gnutls_protocol_get_name(gnutls_protocol_get_version(SSL_P(F)));
|
||||||
gnutls_kx_get_name(gnutls_kx_get(SSL_P(F))),
|
|
||||||
gnutls_cipher_get_name(gnutls_cipher_get(SSL_P(F))),
|
const char* kex_alg_name =
|
||||||
|
gnutls_kx_get_name(gnutls_kx_get(SSL_P(F)));
|
||||||
|
|
||||||
|
const char* cipher_alg_name =
|
||||||
|
gnutls_cipher_get_name(gnutls_cipher_get(SSL_P(F)));
|
||||||
|
|
||||||
|
const char* mac_alg_name =
|
||||||
gnutls_mac_get_name(gnutls_mac_get(SSL_P(F))));
|
gnutls_mac_get_name(gnutls_mac_get(SSL_P(F))));
|
||||||
|
|
||||||
|
(void) rb_snprintf(buf, sizeof buf, "%s%s%s%s%s%s%s",
|
||||||
|
proto_name ? proto_name : "",
|
||||||
|
proto_name ? ", " : "",
|
||||||
|
kex_alg_name ? kex_alg_name : "",
|
||||||
|
kex_alg_name ? "-" : "",
|
||||||
|
cipher_alg_name ? cipher_alg_name : "",
|
||||||
|
cipher_alg_name ? "-" : "",
|
||||||
|
mac_alg_name ? mac_alg_name : "",
|
||||||
|
mac_alg_name ? "-" : "");
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue