[proxy,config] PEM length must contain '\0'

This commit is contained in:
Armin Novak 2023-05-08 14:04:08 +02:00 committed by David Fort
parent 01e4624ed7
commit 7212621eae
2 changed files with 3 additions and 1 deletions

View File

@ -219,7 +219,7 @@ char* crypto_read_pem(const char* filename, size_t* plength)
goto fail;
if (plength)
*plength = (size_t)size;
*plength = (size_t)strnlen(pem, size);
fclose(fp);
return pem;

View File

@ -480,6 +480,7 @@ static BOOL pf_config_load_certificates(wIniFile* ini, proxyConfig* config)
crypto_read_pem(config->CertificateFile, &config->CertificatePEMLength);
if (!config->CertificatePEM)
return FALSE;
config->CertificatePEMLength += 1;
}
tmp2 = pf_config_get_str(ini, section_certificates, key_cert_content, FALSE);
if (tmp2)
@ -526,6 +527,7 @@ static BOOL pf_config_load_certificates(wIniFile* ini, proxyConfig* config)
crypto_read_pem(config->PrivateKeyFile, &config->PrivateKeyPEMLength);
if (!config->PrivateKeyPEM)
return FALSE;
config->PrivateKeyPEMLength += 1;
}
tmp2 = pf_config_get_str(ini, section_certificates, key_private_key_content, FALSE);
if (tmp2)