if (init_external_addin(plugin) < 0)
return FALSE;
- strcpy(channelDef.name, RDP2TCP_CHAN_NAME);
+ strncpy(channelDef.name, RDP2TCP_CHAN_NAME, sizeof(channelDef.name));
channelDef.options =
CHANNEL_OPTION_INITIALIZED |
CHANNEL_OPTION_ENCRYPT_RDP |
const char* expected_result;
} certificate_test_t;
-char* crypto_cert_subject_common_name_wo_length(X509* xcert)
+static char* crypto_cert_subject_common_name_wo_length(X509* xcert)
{
int length;
return crypto_cert_subject_common_name(xcert, & length);
}
-char* certificate_path()
+static char* certificate_path(void)
{
/*
Assume the .pem file is in the same directory as this source file.
if (last_dirsep)
{
- char* result = malloc(last_dirsep - file + 1 + strnlen(filename, sizeof(filename)) + 1);
- strncpy(result, file, (last_dirsep - file + 1));
- strcpy(result + (last_dirsep - file + 1), filename);
+ const size_t filenameLen = strnlen(filename, sizeof(filename));
+ const size_t dirsepLen = last_dirsep - file + 1;
+ char* result = malloc(dirsepLen + filenameLen + 1);
+ if (!result)
+ return NULL;
+ strncpy(result, file, dirsepLen);
+ strncpy(result + dirsepLen, filename, filenameLen + 1);
return result;
}
else
}
}
-const certificate_test_t certificate_tests[] =
+static const certificate_test_t certificate_tests[] =
{
{
-int TestCertificateFile(const char* certificate_path, const certificate_test_t* certificate_tests,
+static int TestCertificateFile(const char* certificate_path, const certificate_test_t* certificate_tests,
int count)
{
X509* certificate;