fix: use strncpy_s

This commit is contained in:
2026-05-12 17:40:34 -03:00
parent 589ce787b5
commit b435e149ae
+2 -2
View File
@@ -52,7 +52,7 @@ WOLFSSL_CTX* CertificateManager::createHostContext(const std::string& host)
memset(cert.get(), 0, sizeof(Cert)); memset(cert.get(), 0, sizeof(Cert));
wc_InitCert(cert.get()); 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->sigType = CTC_SHA256wRSA;
cert->daysValid = 365; cert->daysValid = 365;
@@ -101,7 +101,7 @@ bool CertificateManager::generateCA()
memset(cert.get(), 0, sizeof(Cert)); memset(cert.get(), 0, sizeof(Cert));
wc_InitCert(cert.get()); 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->isCA = 1;
cert->sigType = CTC_SHA256wRSA; cert->sigType = CTC_SHA256wRSA;
cert->daysValid = 3650; cert->daysValid = 3650;