summaryrefslogtreecommitdiff
path: root/src/SSL_Certificate.c
diff options
context:
space:
mode:
authorlishu <[email protected]>2018-11-29 21:34:25 +0800
committerlishu <[email protected]>2018-11-29 21:34:25 +0800
commit8a731c972bb97b5d814083c5ac700c1f25bf2ba2 (patch)
tree5b5c7dab99ff0ecb4d80d03fe06ca65785418fe1 /src/SSL_Certificate.c
parent6e703c4335a6a724d36bcea4d257330d281650e7 (diff)
san bug修复,san可能为NULL
Diffstat (limited to 'src/SSL_Certificate.c')
-rw-r--r--src/SSL_Certificate.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/SSL_Certificate.c b/src/SSL_Certificate.c
index 49f4c61..2a7f7e7 100644
--- a/src/SSL_Certificate.c
+++ b/src/SSL_Certificate.c
@@ -1093,19 +1093,26 @@ UCHAR fn_pGetSSLInfo(char *pcCert, int iLen, ssl_stream *a_ssl_stream, struct
char* san = NULL;
int len = 0;
if(cnt>0)
- {
- a_ssl_stream->stSSLCert->SSLSubAltName = (st_san_t*)malloc(sizeof(st_san_t));
+ {
+ a_ssl_stream->stSSLCert->SSLSubAltName = (st_san_t*)dictator_malloc(thread_seq, sizeof(st_san_t));
a_ssl_stream->stSSLCert->SSLSubAltName->count = cnt;
for (int i = 0; i < cnt; i++)
{
GENERAL_NAME* generalName = sk_GENERAL_NAME_value(subjectAltNames, i);
san = (char*)ASN1_STRING_data((ASN1_STRING*)GENERAL_NAME_get0_value(generalName, NULL));
+ /*
snprintf(a_ssl_stream->stSSLCert->SSLSubAltName->san[i],
sizeof(a_ssl_stream->stSSLCert->SSLSubAltName->san[i]),
"%s",
san);
+ */
+ if(san!=NULL)
+ {
+ memcpy(a_ssl_stream->stSSLCert->SSLSubAltName->san[i],san,strlen(san));
+ }
}
}
- }
+ }
+ return SSL_RETURN_NORM;
}