diff --git a/winpr/tools/makecert/makecert.c b/winpr/tools/makecert/makecert.c index 82fc42065..fcac5cf33 100644 --- a/winpr/tools/makecert/makecert.c +++ b/winpr/tools/makecert/makecert.c @@ -326,7 +326,11 @@ int command_line_pre_filter(MAKECERT_CONTEXT* context, int index, int argc, LPCS if (index == (argc - 1)) { if (argv[index][0] != '-') - context->output_file = (char*) argv[index]; + { + context->output_file = _strdup(argv[index]); + if (!context->output_file) + return -1; + } return 1; } @@ -728,7 +732,11 @@ int makecert_context_output_private_key_file(MAKECERT_CONTEXT* context, char* pa return 1; if (!context->output_file) - context->output_file = context->default_name; + { + context->output_file = _strdup(context->default_name); + if (!context->output_file) + return -1; + } /** * Output Private Key File @@ -1083,7 +1091,10 @@ int makecert_context_process(MAKECERT_CONTEXT* context, int argc, char** argv) makecert_context_output_certificate_file(context, context->output_path); if (context->crtFormat) - makecert_context_output_private_key_file(context, context->output_path); + { + if (makecert_context_output_private_key_file(context, context->output_path) < 0) + return -1; + } } return 0;