summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlishu <[email protected]>2018-12-04 15:59:24 +0800
committerlishu <[email protected]>2018-12-04 15:59:24 +0800
commit8555406158c830a7838d32767c36df1e871ef6be (patch)
treea7470b07fe2c4558d1e2997bf0887688dfabbcb9 /src
parent4fb7dbe48c81b6bd84a4f020b35d4a11a0839e43 (diff)
修复证书subject越界的Bug
Diffstat (limited to 'src')
-rw-r--r--src/SSL_Analyze.c3
-rw-r--r--src/SSL_Certificate.c9
2 files changed, 9 insertions, 3 deletions
diff --git a/src/SSL_Analyze.c b/src/SSL_Analyze.c
index 558403d..a7471ce 100644
--- a/src/SSL_Analyze.c
+++ b/src/SSL_Analyze.c
@@ -19,7 +19,7 @@
ssl_prog_runtime_parameter_t g_ssl_prog_para;
-int SSL_VERSION_1_20181129 = 0;
+int SSL_VERSION_1_20181204 = 0;
void ssl_history()
{
@@ -63,6 +63,7 @@ void ssl_history()
//2018-07-30 V0.2 APPLICATION_DATA bug
//2018-11-08 V0.2 multi-san
//2018-11-29 V0.2 san dictator_malloc
+//2018-12-04 V0.2 openssl parse certificate bug
//to do
diff --git a/src/SSL_Certificate.c b/src/SSL_Certificate.c
index b4325fb..252e812 100644
--- a/src/SSL_Certificate.c
+++ b/src/SSL_Certificate.c
@@ -1038,7 +1038,7 @@ UCHAR fn_pGetSSLInfo(char *pcCert, int iLen, ssl_stream *a_ssl_stream, struct
//return SSL_RETURN_NORM;
int data = 0;
- X509 * x509_handle = d2i_X509(NULL, (unsigned char const **)&pcCert, iLen);
+ X509 *x509_handle = d2i_X509(NULL, (unsigned char const **)&pcCert, iLen);
if (x509_handle == NULL)
{
return SSL_RETURN_NORM;
@@ -1088,7 +1088,12 @@ UCHAR fn_pGetSSLInfo(char *pcCert, int iLen, ssl_stream *a_ssl_stream, struct
X509_NAME_get_text_by_NID(subject, NID_organizationName, a_ssl_stream->stSSLCert->SSLSubO, sizeof(a_ssl_stream->stSSLCert->SSLSubO));
X509_NAME_get_text_by_NID(subject, NID_countryName, a_ssl_stream->stSSLCert->SSLSubC, sizeof(a_ssl_stream->stSSLCert->SSLSubC));
- memcpy(a_ssl_stream->stSSLCert->SSLSub, x509_handle->name,strlen(x509_handle->name));
+ snprintf(a_ssl_stream->stSSLCert->SSLSub,
+ sizeof(a_ssl_stream->stSSLCert->SSLSub),
+ "%s;%s;%s",
+ a_ssl_stream->stSSLCert->SSLSubCN,
+ a_ssl_stream->stSSLCert->SSLSubO,
+ a_ssl_stream->stSSLCert->SSLSubC);
}
/*validity*/