Skip to content
Snippets Groups Projects
Commit 48557e9e authored by Emily Ehlert's avatar Emily Ehlert
Browse files

Fix problematic strcpy

parent 72449b5c
Branches
No related merge requests found
...@@ -206,8 +206,9 @@ OPENVPN_EXPORT int openvpn_plugin_open_v3(const int v3structver, struct openvpn_ ...@@ -206,8 +206,9 @@ OPENVPN_EXPORT int openvpn_plugin_open_v3(const int v3structver, struct openvpn_
// Access Code // Access Code
if (strcmp(argv[2], "0") != 0) if (strcmp(argv[2], "0") != 0)
{ {
context->acc_code = calloc(strlen(argv[2]) + 1, sizeof(char)); unsigned long access_code_length = strlen(argv[2]) + 1;
strcpy(context->acc_code, argv[2]); context->acc_code = calloc(access_code_length, sizeof(char));
snprintf(context->acc_code, access_code_length, "%s", argv[2]);
plog(PLOG_DEBUG, "Using access code %s", context->acc_code); plog(PLOG_DEBUG, "Using access code %s", context->acc_code);
if (! context->acc_code) if (! context->acc_code)
{ {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment