From: Vincent Lefevre Date: Mon, 21 Nov 2016 22:10:47 +0000 (+0100) Subject: Make sure that the output of X509_NAME_oneline is null-terminated. X-Git-Tag: mutt-1-8-rel~70 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bb594a6cf45fadba334ed3e4896d0a71e86a0815;p=mutt Make sure that the output of X509_NAME_oneline is null-terminated. --- diff --git a/mutt_ssl.c b/mutt_ssl.c index a80fe5eb..0bca243f 100644 --- a/mutt_ssl.c +++ b/mutt_ssl.c @@ -969,9 +969,10 @@ static int ssl_check_certificate (CONNECTION *conn, sslsockdata *data) #ifdef DEBUG char buf[STRING]; + buf[STRING - 1] = '\0'; dprint (1, (debugfile, "ssl_check_certificate: checking cert %s\n", X509_NAME_oneline (X509_get_subject_name (data->cert), - buf, sizeof (buf)))); + buf, sizeof (buf) - 1))); #endif if ((preauthrc = ssl_check_preauth (data->cert, conn->account.host)) > 0) @@ -991,7 +992,7 @@ static int ssl_check_certificate (CONNECTION *conn, sslsockdata *data) dprint (1, (debugfile, "ssl_check_certificate: checking cert chain entry %s\n", X509_NAME_oneline (X509_get_subject_name (cert), - buf, sizeof (buf)))); + buf, sizeof (buf) - 1))); /* if the certificate validates or is manually accepted, then add it to * the trusted set and recheck the peer certificate */