Throw error on bad URI

This commit is contained in:
Bender Dev 2025-03-07 01:33:12 -05:00
parent 262ad64944
commit b04d2d81d0
3 changed files with 7 additions and 1 deletions

View File

@ -64,8 +64,12 @@ static int x509v3_add_len_value(const char *name, const char *value,
ERR_raise(ERR_LIB_X509V3, ERR_R_CRYPTO_LIB);
goto err;
}
int err_raised = 0;
if (!is_valid_uri(value) && strncmp(name, "URI", 3) == 0) {
/* Figure out proper error to raise here */
ERR_raise(ERR_LIB_X509V3, X509V3_R_INVALID_URI);
err_raised = 1;
}
if (err_raised) {
goto err;
}
vtmp->section = NULL;

View File

@ -85,6 +85,7 @@ static const ERR_STRING_DATA X509V3_str_reasons[] = {
{ERR_PACK(ERR_LIB_X509V3, 0, X509V3_R_INVALID_SAFI), "invalid safi"},
{ERR_PACK(ERR_LIB_X509V3, 0, X509V3_R_INVALID_SECTION), "invalid section"},
{ERR_PACK(ERR_LIB_X509V3, 0, X509V3_R_INVALID_SYNTAX), "invalid syntax"},
{ERR_PACK(ERR_LIB_X509V3, 0, X509V3_R_INVALID_URI), "invalid URI"},
{ERR_PACK(ERR_LIB_X509V3, 0, X509V3_R_ISSUER_DECODE_ERROR),
"issuer decode error"},
{ERR_PACK(ERR_LIB_X509V3, 0, X509V3_R_MISSING_VALUE), "missing value"},

View File

@ -64,6 +64,7 @@
# define X509V3_R_INVALID_SAFI 164
# define X509V3_R_INVALID_SECTION 135
# define X509V3_R_INVALID_SYNTAX 143
# define X509V3_R_INVALID_URI 173
# define X509V3_R_ISSUER_DECODE_ERROR 126
# define X509V3_R_MISSING_VALUE 124
# define X509V3_R_NEED_ORGANIZATION_AND_NUMBERS 142