Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Dec 7, 2023. It is now read-only.

Commit fb1f0ab

Browse files
Christopher Powersbjornmu
authored andcommitted
Bug#21863597 SHOW STATUS LIKE '%SSL%' CRASHING SERVER
The 5.7 implementation of SHOW STATUS exposed a potential crash in the handling of SSL status variables. The crash occurs because the SSL status variable callback function, show_ssl_get_server_not_after(), passes a null ASN1 time pointer to my_asn1_time_to_string(). This callback function and its counterpart, show_ssl_get_server_not_before(), now check the value of the ASN1 time pointer. If NULL, then the callback returns an empty string. (cherry picked from commit 4b3ba08e4cc6067d9f7159c7a31cbbe4b9718b71)
1 parent f06b4f4 commit fb1f0ab

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

sql/mysqld.cc

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6434,11 +6434,19 @@ show_ssl_get_server_not_before(THD *thd, SHOW_VAR *var, char *buff)
64346434
X509 *cert= SSL_get_certificate(ssl_acceptor);
64356435
ASN1_TIME *not_before= X509_get_notBefore(cert);
64366436

6437+
if (not_before == NULL)
6438+
{
6439+
var->value= empty_c_string;
6440+
return 0;
6441+
}
6442+
64376443
var->value= my_asn1_time_to_string(not_before, buff,
64386444
SHOW_VAR_FUNC_BUFF_SIZE);
6439-
if (!var->value)
6445+
if (var->value == NULL)
6446+
{
6447+
var->value= empty_c_string;
64406448
return 1;
6441-
var->value= buff;
6449+
}
64426450
}
64436451
else
64446452
var->value= empty_c_string;
@@ -6466,10 +6474,19 @@ show_ssl_get_server_not_after(THD *thd, SHOW_VAR *var, char *buff)
64666474
X509 *cert= SSL_get_certificate(ssl_acceptor);
64676475
ASN1_TIME *not_after= X509_get_notAfter(cert);
64686476

6477+
if (not_after == NULL)
6478+
{
6479+
var->value= empty_c_string;
6480+
return 0;
6481+
}
6482+
64696483
var->value= my_asn1_time_to_string(not_after, buff,
64706484
SHOW_VAR_FUNC_BUFF_SIZE);
6471-
if (!var->value)
6485+
if (var->value == NULL)
6486+
{
6487+
var->value= empty_c_string;
64726488
return 1;
6489+
}
64736490
}
64746491
else
64756492
var->value= empty_c_string;

0 commit comments

Comments
 (0)