hx509: Avoid misleading error message

If ‘keyid’ is an empty string, then the numeric error code that gets
appended to this error message may be mistaken for the key ID. Address
this by not mentioning any ID in such cases.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
This commit is contained in:
Joseph Sutton
2023-06-23 12:48:51 +12:00
committed by Jeffrey Altman
parent df6c33ff1e
commit 59f89e4b15

View File

@@ -242,7 +242,10 @@ unparse_CMSIdentifier(hx509_context context,
if (len < 0)
return ENOMEM;
ret = asprintf(str, "certificate with id %s", keyid);
if (len)
ret = asprintf(str, "certificate with id %s", keyid);
else
ret = asprintf(str, "certificate");
free(keyid);
break;
}