Skip to content

Commit a9e26fe

Browse files
nhatnghihojustsmth
andauthored
Use explicit check for X509 path length (#3080)
### Description of changes: Add an explicit bounds check for X509 path length By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license. --------- Co-authored-by: Justin W Smith <103147162+justsmth@users.noreply.github.com>
1 parent efb6ba9 commit a9e26fe

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

crypto/x509/x509_vfy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ static int check_chain_extensions(X509_STORE_CTX *ctx) {
676676
}
677677
// Check pathlen if not self issued
678678
if (i > 1 && !(x->ex_flags & EXFLAG_SI) && x->ex_pathlen != -1 &&
679-
plen > x->ex_pathlen + 1) {
679+
plen - 1 > x->ex_pathlen) {
680680
ctx->error = X509_V_ERR_PATH_LENGTH_EXCEEDED;
681681
ctx->error_depth = i;
682682
ctx->current_cert = x;

0 commit comments

Comments
 (0)