summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-05-04 22:00:24 +0200
committerSergei Golubchik <serg@mariadb.org>2015-05-04 22:00:24 +0200
commit49c853fb948aeaeb5c7e3f02da3f14da51ee4100 (patch)
tree8c3d487a02209cc0c6f126144f1340fc5897d527 /sql-common
parentae18a28500974351cf42fa3cac67c83e0647d510 (diff)
parent4c87f727734955f9e4a0ffde25aae4d43ec0b2a5 (diff)
downloadmariadb-git-49c853fb948aeaeb5c7e3f02da3f14da51ee4100.tar.gz
Merge branch '5.5' into 10.0
Diffstat (limited to 'sql-common')
-rw-r--r--sql-common/client.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sql-common/client.c b/sql-common/client.c
index 4b443680e7b..c180986cbe9 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1942,7 +1942,7 @@ static int ssl_verify_server_cert(Vio *vio, const char* server_hostname, const c
SSL *ssl;
X509 *server_cert;
char *cp1, *cp2;
- char buf[256];
+ char *buf;
DBUG_ENTER("ssl_verify_server_cert");
DBUG_PRINT("enter", ("server_hostname: %s", server_hostname));
@@ -1976,9 +1976,15 @@ static int ssl_verify_server_cert(Vio *vio, const char* server_hostname, const c
are what we expect.
*/
- X509_NAME_oneline(X509_get_subject_name(server_cert), buf, sizeof(buf));
+ buf= X509_NAME_oneline(X509_get_subject_name(server_cert), 0, 0);
X509_free (server_cert);
+ if (!buf)
+ {
+ *errptr= "Out of memory";
+ DBUG_RETURN(1);
+ }
+
DBUG_PRINT("info", ("hostname in cert: %s", buf));
cp1= strstr(buf, "/CN=");
if (cp1)
@@ -1991,11 +1997,13 @@ static int ssl_verify_server_cert(Vio *vio, const char* server_hostname, const c
DBUG_PRINT("info", ("Server hostname in cert: %s", cp1));
if (!strcmp(cp1, server_hostname))
{
+ free(buf);
/* Success */
DBUG_RETURN(0);
}
}
*errptr= "SSL certificate validation failure";
+ free(buf);
DBUG_RETURN(1);
}