hx509: do not crash on missing FILE: name

This commit is contained in:
Nicolas Williams
2019-07-03 20:09:13 -05:00
parent cc8a5c59a8
commit 63116100a8
4 changed files with 23 additions and 0 deletions

View File

@@ -59,6 +59,12 @@ dir_init(hx509_context context,
{
*data = NULL;
if (residue == NULL || residue[0] == '\0') {
hx509_set_error_string(context, 0, EINVAL,
"DIR file name not specified");
return EINVAL;
}
{
struct stat sb;
int ret;

View File

@@ -384,6 +384,12 @@ file_init_common(hx509_context context,
pem_ctx.flags = flags;
pem_ctx.c = NULL;
if (residue == NULL || residue[0] == '\0') {
hx509_set_error_string(context, 0, EINVAL,
"PEM file name not specified");
return EINVAL;
}
*data = NULL;
if (lock == NULL)

View File

@@ -820,6 +820,11 @@ p11_init(hx509_context context,
*data = NULL;
if (residue == NULL || residue[0] == '\0') {
hx509_set_error_string(context, 0, EINVAL,
"PKCS#11 store not specified");
return EINVAL;
}
list = strdup(residue);
if (list == NULL)
return ENOMEM;

View File

@@ -338,6 +338,12 @@ p12_init(hx509_context context,
*data = NULL;
if (residue == NULL || residue[0] == '\0') {
hx509_set_error_string(context, 0, EINVAL,
"PKCS#12 file not specified");
return EINVAL;
}
if (lock == NULL)
lock = _hx509_empty_lock;