diff options
Diffstat (limited to 'src/lib/libcrypto/x509/x509_vfy.c')
-rw-r--r-- | src/lib/libcrypto/x509/x509_vfy.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/lib/libcrypto/x509/x509_vfy.c b/src/lib/libcrypto/x509/x509_vfy.c index 9a62ebcf67..336c40ddd7 100644 --- a/src/lib/libcrypto/x509/x509_vfy.c +++ b/src/lib/libcrypto/x509/x509_vfy.c | |||
@@ -394,7 +394,7 @@ static int check_chain_extensions(X509_STORE_CTX *ctx) | |||
394 | #ifdef OPENSSL_NO_CHAIN_VERIFY | 394 | #ifdef OPENSSL_NO_CHAIN_VERIFY |
395 | return 1; | 395 | return 1; |
396 | #else | 396 | #else |
397 | int i, ok=0, must_be_ca; | 397 | int i, ok=0, must_be_ca, plen = 0; |
398 | X509 *x; | 398 | X509 *x; |
399 | int (*cb)(int xok,X509_STORE_CTX *xctx); | 399 | int (*cb)(int xok,X509_STORE_CTX *xctx); |
400 | int proxy_path_length = 0; | 400 | int proxy_path_length = 0; |
@@ -495,9 +495,10 @@ static int check_chain_extensions(X509_STORE_CTX *ctx) | |||
495 | if (!ok) goto end; | 495 | if (!ok) goto end; |
496 | } | 496 | } |
497 | } | 497 | } |
498 | /* Check pathlen */ | 498 | /* Check pathlen if not self issued */ |
499 | if ((i > 1) && (x->ex_pathlen != -1) | 499 | if ((i > 1) && !(x->ex_flags & EXFLAG_SI) |
500 | && (i > (x->ex_pathlen + proxy_path_length + 1))) | 500 | && (x->ex_pathlen != -1) |
501 | && (plen > (x->ex_pathlen + proxy_path_length + 1))) | ||
501 | { | 502 | { |
502 | ctx->error = X509_V_ERR_PATH_LENGTH_EXCEEDED; | 503 | ctx->error = X509_V_ERR_PATH_LENGTH_EXCEEDED; |
503 | ctx->error_depth = i; | 504 | ctx->error_depth = i; |
@@ -505,6 +506,9 @@ static int check_chain_extensions(X509_STORE_CTX *ctx) | |||
505 | ok=cb(0,ctx); | 506 | ok=cb(0,ctx); |
506 | if (!ok) goto end; | 507 | if (!ok) goto end; |
507 | } | 508 | } |
509 | /* Increment path length if not self issued */ | ||
510 | if (!(x->ex_flags & EXFLAG_SI)) | ||
511 | plen++; | ||
508 | /* If this certificate is a proxy certificate, the next | 512 | /* If this certificate is a proxy certificate, the next |
509 | certificate must be another proxy certificate or a EE | 513 | certificate must be another proxy certificate or a EE |
510 | certificate. If not, the next certificate must be a | 514 | certificate. If not, the next certificate must be a |