forked from wolfSSL/wolfssl
alter search behavior for testing if URI is a absolute path
This commit is contained in:
@@ -5717,9 +5717,28 @@ static int DecodeAltNames(byte* input, int sz, DecodedCert* cert)
|
|||||||
/* Verify RFC 5280 Sec 4.2.1.6 rule:
|
/* Verify RFC 5280 Sec 4.2.1.6 rule:
|
||||||
"The name MUST NOT be a relative URI" */
|
"The name MUST NOT be a relative URI" */
|
||||||
|
|
||||||
if (XSTRNSTR((const char*)&input[idx], "://", strLen + 1) == NULL) {
|
{
|
||||||
WOLFSSL_MSG("\tAlt Name must be absolute URI");
|
int i;
|
||||||
return ASN_ALT_NAME_E;
|
|
||||||
|
/* skip past scheme (i.e http,ftp,...) finding first ':' char */
|
||||||
|
for (i = 0; i < strLen; i++) {
|
||||||
|
if (input[idx + i] == ':') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (input[idx + i] == '/') {
|
||||||
|
i = strLen; /* error, found relative path since '/' was
|
||||||
|
* encountered before ':'. Returning error
|
||||||
|
* value in next if statement. */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* test if no ':' char was found and test that the next two
|
||||||
|
* chars are // to match the pattern "://" */
|
||||||
|
if (i == strLen || (input[idx + i + 1] != '/' ||
|
||||||
|
input[idx + i + 2] != '/')) {
|
||||||
|
WOLFSSL_MSG("\tAlt Name must be absolute URI");
|
||||||
|
return ASN_ALT_NAME_E;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user