fix: use strncpy_s
This commit is contained in:
@@ -52,7 +52,7 @@ WOLFSSL_CTX* CertificateManager::createHostContext(const std::string& host)
|
||||
memset(cert.get(), 0, sizeof(Cert));
|
||||
wc_InitCert(cert.get());
|
||||
|
||||
strncpy(cert->subject.commonName, host.c_str(), sizeof(cert->subject.commonName));
|
||||
strncpy_s(cert->subject.commonName, sizeof(cert->subject.commonName), host.c_str(), _TRUNCATE);
|
||||
cert->sigType = CTC_SHA256wRSA;
|
||||
cert->daysValid = 365;
|
||||
|
||||
@@ -101,7 +101,7 @@ bool CertificateManager::generateCA()
|
||||
memset(cert.get(), 0, sizeof(Cert));
|
||||
wc_InitCert(cert.get());
|
||||
|
||||
strncpy(cert->subject.commonName, "TinyMITM-CA", sizeof(cert->subject.commonName));
|
||||
strncpy_s(cert->subject.commonName, sizeof(cert->subject.commonName), "TinyMITM-CA", _TRUNCATE);
|
||||
cert->isCA = 1;
|
||||
cert->sigType = CTC_SHA256wRSA;
|
||||
cert->daysValid = 3650;
|
||||
|
||||
Reference in New Issue
Block a user