makecert: Add strdup checks

This commit is contained in:
Martin Fleisz 2015-06-29 18:07:26 +02:00
parent 5632773808
commit bdf02d631e
1 changed files with 14 additions and 3 deletions

View File

@ -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 = _strdup(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 = _strdup(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;