]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_stir_shaken: avoid direct ASN1_STRING accesses
authorBernd Kuhls <bernd@kuhls.net>
Sat, 2 May 2026 12:20:05 +0000 (14:20 +0200)
committergithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Tue, 2 Jun 2026 16:15:39 +0000 (16:15 +0000)
https://github.com/openssl/openssl/issues/29117

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
Resolves: #1952

res/res_stir_shaken/verification.c

index 209032e23b3f042b37473e451fb71d92c11efe94..3fed81a9789d07dbc6041bfc753cfc4b62b3a09c 100644 (file)
@@ -266,10 +266,10 @@ static enum ast_stir_shaken_vs_response_code
                        LOG_ERROR, "%s: Cert '%s' doesn't have a TNAuthList extension\n",
                        ctx->tag, ctx->public_url);
        }
-       octet_str_data = tn_exten->data;
+       octet_str_data = ASN1_STRING_get0_data(tn_exten);
 
        /* The first call to ASN1_get_object should return a SEQUENCE */
-       ret = ASN1_get_object(&octet_str_data, &xlen, &tag, &xclass, tn_exten->length);
+       ret = ASN1_get_object(&octet_str_data, &xlen, &tag, &xclass, ASN1_STRING_length(tn_exten));
        if (IS_GET_OBJ_ERR(ret)) {
                crypto_log_openssl(LOG_ERROR, "%s: Cert '%s' has malformed TNAuthList extension\n",
                        ctx->tag, ctx->public_url);
@@ -293,7 +293,7 @@ static enum ast_stir_shaken_vs_response_code
         * ATIS-1000080 however limits this to only ASN1_TAG_TNAUTH_SPC
         *
         */
-       ret = ASN1_get_object(&octet_str_data, &xlen, &tag, &xclass, tn_exten->length);
+       ret = ASN1_get_object(&octet_str_data, &xlen, &tag, &xclass, ASN1_STRING_length(tn_exten));
        if (IS_GET_OBJ_ERR(ret)) {
                crypto_log_openssl(LOG_ERROR, "%s: Cert '%s' has malformed TNAuthList extension\n",
                        ctx->tag, ctx->public_url);
@@ -307,7 +307,7 @@ static enum ast_stir_shaken_vs_response_code
        }
 
        /* The third call to ASN1_get_object should contain the SPC */
-       ret = ASN1_get_object(&octet_str_data, &xlen, &tag, &xclass, tn_exten->length);
+       ret = ASN1_get_object(&octet_str_data, &xlen, &tag, &xclass, ASN1_STRING_length(tn_exten));
        if (ret != 0) {
                SCOPE_EXIT_LOG_RTN_VALUE(AST_STIR_SHAKEN_VS_CERT_NO_SPC_IN_TN_AUTH_EXT,
                        LOG_ERROR, "%s: Cert '%s' has malformed TNAuthList extension (no SPC)\n",