fix: fix logic defects in certificate chain length calculation

1.Avoid infinite loops caused by circular certificate chains.

2.Prevent potential integer overflow issues.

Signed-off-by: Guo Yitao <414989582@qq.com>
This commit is contained in:
Guo Yitao
2026-02-26 14:19:25 +08:00
parent 57a2e8f3f7
commit 7e33971722
+3
View File
@@ -195,6 +195,9 @@ void code_sign_verify_certchain(const void *raw_pkcs7, size_t pkcs7_len,
break;
}
cert_chain_depth_without_root++;
if (cert_chain_depth_without_root > (source->max_path_depth - 1)) {
break;
}
// search again for current issuer's issuer
issuer = cert->issuer;
cert = pkcs7->certs;