Merge pull request #2745 from mfleisz/fix_makecert
makecert: Fix double free crashes
This commit is contained in:
commit
cc4b5f98c3
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user