Skip to content

Commit 286415a

Browse files
committed
wrap crl_dp checks in if (certs && (lookup <= 1). Fixes #5515
1 parent 38ab70d commit 286415a

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

src/main/tls.c

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3077,30 +3077,33 @@ int cbtls_verify(int ok, X509_STORE_CTX *ctx)
30773077
/*
30783078
* Get the Certificate Distribution points
30793079
*/
3080-
crl_dp = X509_get_ext_d2i(client_cert, NID_crl_distribution_points, NULL, NULL);
3081-
if (crl_dp) {
3082-
DIST_POINT *dp;
3083-
const char *url_ptr;
3080+
if (certs && (lookup <= 1)) {
3081+
crl_dp = X509_get_ext_d2i(client_cert, NID_crl_distribution_points, NULL, NULL);
30843082

3085-
for (int i = 0; i < sk_DIST_POINT_num(crl_dp); i++) {
3086-
size_t len;
3087-
char cdp[1024];
3083+
if (crl_dp) {
3084+
DIST_POINT *dp;
3085+
const char *url_ptr;
30883086

3089-
dp = sk_DIST_POINT_value(crl_dp, i);
3090-
if (!dp) continue;
3087+
for (int i = 0; i < sk_DIST_POINT_num(crl_dp); i++) {
3088+
size_t len;
3089+
char cdp[1024];
30913090

3092-
url_ptr = get_cdp_url(dp);
3093-
if (!url_ptr) continue;
3091+
dp = sk_DIST_POINT_value(crl_dp, i);
3092+
if (!dp) continue;
30943093

3095-
len = strlen(url_ptr);
3096-
if (len >= sizeof(cdp)) continue;
3094+
url_ptr = get_cdp_url(dp);
3095+
if (!url_ptr) continue;
30973096

3098-
memcpy(cdp, url_ptr, len + 1);
3097+
len = strlen(url_ptr);
3098+
if (len >= sizeof(cdp)) continue;
30993099

3100-
vp = fr_pair_make(talloc_ctx, certs, cert_attr_names[FR_TLS_CDP][lookup], cdp, T_OP_ADD);
3101-
rdebug_pair(L_DBG_LVL_2, request, vp, NULL);
3100+
memcpy(cdp, url_ptr, len + 1);
3101+
3102+
vp = fr_pair_make(talloc_ctx, certs, cert_attr_names[FR_TLS_CDP][lookup], cdp, T_OP_ADD);
3103+
rdebug_pair(L_DBG_LVL_2, request, vp, NULL);
3104+
}
3105+
sk_DIST_POINT_pop_free(crl_dp, DIST_POINT_free);
31023106
}
3103-
sk_DIST_POINT_pop_free(crl_dp, DIST_POINT_free);
31043107
}
31053108

31063109
/*

0 commit comments

Comments
 (0)