crypto/evp/pmeth_lib.c:582: error: NULL_DEREFERENCE
  pointer `name` last assigned on line 573 could be null and is dereferenced by call to `strlen()` at line 582, column 45.
Showing all 17 steps of the trace


crypto/evp/pmeth_lib.c:551:1: start of procedure EVP_PKEY_CTX_set_signature_md()
549.   }
550.   
551. > int EVP_PKEY_CTX_set_signature_md(EVP_PKEY_CTX *ctx, const EVP_MD *md)
552.   {
553.       OSSL_PARAM sig_md_params[3], *p = sig_md_params;

crypto/evp/pmeth_lib.c:553:5: 
551.   int EVP_PKEY_CTX_set_signature_md(EVP_PKEY_CTX *ctx, const EVP_MD *md)
552.   {
553. >     OSSL_PARAM sig_md_params[3], *p = sig_md_params;
554.       size_t mdsize;
555.       const char *name;

crypto/evp/pmeth_lib.c:557:9: Taking false branch
555.       const char *name;
556.   
557.       if (ctx == NULL || !EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx)) {
               ^
558.           ERR_raise(ERR_LIB_EVP, EVP_R_COMMAND_NOT_SUPPORTED);
559.           /* Uses the same return values as EVP_PKEY_CTX_ctrl */

crypto/evp/pmeth_lib.c:557:25: Taking true branch
555.       const char *name;
556.   
557.       if (ctx == NULL || !EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx)) {
                               ^
558.           ERR_raise(ERR_LIB_EVP, EVP_R_COMMAND_NOT_SUPPORTED);
559.           /* Uses the same return values as EVP_PKEY_CTX_ctrl */

crypto/evp/pmeth_lib.c:557:25: Taking true branch
555.       const char *name;
556.   
557.       if (ctx == NULL || !EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx)) {
                               ^
558.           ERR_raise(ERR_LIB_EVP, EVP_R_COMMAND_NOT_SUPPORTED);
559.           /* Uses the same return values as EVP_PKEY_CTX_ctrl */

crypto/evp/pmeth_lib.c:557:25: Taking true branch
555.       const char *name;
556.   
557.       if (ctx == NULL || !EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx)) {
                               ^
558.           ERR_raise(ERR_LIB_EVP, EVP_R_COMMAND_NOT_SUPPORTED);
559.           /* Uses the same return values as EVP_PKEY_CTX_ctrl */

crypto/evp/pmeth_lib.c:557:25: Taking true branch
555.       const char *name;
556.   
557.       if (ctx == NULL || !EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx)) {
                               ^
558.           ERR_raise(ERR_LIB_EVP, EVP_R_COMMAND_NOT_SUPPORTED);
559.           /* Uses the same return values as EVP_PKEY_CTX_ctrl */

crypto/evp/pmeth_lib.c:557:25: Taking false branch
555.       const char *name;
556.   
557.       if (ctx == NULL || !EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx)) {
                               ^
558.           ERR_raise(ERR_LIB_EVP, EVP_R_COMMAND_NOT_SUPPORTED);
559.           /* Uses the same return values as EVP_PKEY_CTX_ctrl */

crypto/evp/pmeth_lib.c:564:9: Taking false branch
562.   
563.       /* TODO(3.0): Remove this eventually when no more legacy */
564.       if (ctx->op.sig.sigprovctx == NULL)
               ^
565.           return EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG,
566.                                    EVP_PKEY_CTRL_MD, 0, (void *)(md));

crypto/evp/pmeth_lib.c:568:9: Taking false branch
566.                                    EVP_PKEY_CTRL_MD, 0, (void *)(md));
567.   
568.       if (md == NULL) {
               ^
569.           name = "";
570.           mdsize = 0;

crypto/evp/pmeth_lib.c:572:9: Skipping EVP_MD_size(): empty list of specs
570.           mdsize = 0;
571.       } else {
572.           mdsize = EVP_MD_size(md);
               ^
573.           name = EVP_MD_name(md);
574.       }

crypto/evp/pmeth_lib.c:573:9: 
571.       } else {
572.           mdsize = EVP_MD_size(md);
573. >         name = EVP_MD_name(md);
574.       }
575.   

crypto/evp/evp_lib.c:468:1: start of procedure EVP_MD_name()
  466.   }
  467.   
  468. > const char *EVP_MD_name(const EVP_MD *md)
  469.   {
  470.       if (md->prov != NULL)

crypto/evp/evp_lib.c:470:9: Taking false branch
  468.   const char *EVP_MD_name(const EVP_MD *md)
  469.   {
  470.       if (md->prov != NULL)
                 ^
  471.           return md->name;
  472.   #ifndef FIPS_MODE

crypto/evp/evp_lib.c:475:5: 
  473.       return OBJ_nid2sn(EVP_MD_nid(md));
  474.   #else
  475. >     return NULL;
  476.   #endif
  477.   }

crypto/evp/evp_lib.c:477:1: return from a call to EVP_MD_name
  475.       return NULL;
  476.   #endif
  477. > }
  478.   
  479.   const OSSL_PROVIDER *EVP_MD_provider(const EVP_MD *md)

crypto/evp/pmeth_lib.c:576:5: 
574.       }
575.   
576. >     *p++ = OSSL_PARAM_construct_utf8_string(OSSL_SIGNATURE_PARAM_DIGEST,
577.                                               /*
578.                                                * Cast away the const. This is read

int EVP_PKEY_CTX_set_signature_md(EVP_PKEY_CTX *ctx, const EVP_MD *md)
{
    OSSL_PARAM sig_md_params[3], *p = sig_md_params;
    size_t mdsize;
    const char *name;
    if (ctx == NULL || !EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx)) {
        ERR_raise(ERR_LIB_EVP, EVP_R_COMMAND_NOT_SUPPORTED);
        return -2;
    }
    if (ctx->op.sig.sigprovctx == NULL)
        return EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG,
                                 EVP_PKEY_CTRL_MD, 0, (void *)(md));
    if (md == NULL) {
        name = "";
        mdsize = 0;
    } else {
        mdsize = EVP_MD_size(md);
        name = EVP_MD_name(md);
    }
    *p++ = OSSL_PARAM_construct_utf8_string(OSSL_SIGNATURE_PARAM_DIGEST,
                                            (char *)name,
                                            strlen(name) + 1);
    *p++ = OSSL_PARAM_construct_size_t(OSSL_SIGNATURE_PARAM_DIGEST_SIZE,
                                       &mdsize);
    *p++ = OSSL_PARAM_construct_end();
    return EVP_PKEY_CTX_set_params(ctx, sig_md_params);
}
['int EVP_PKEY_CTX_set_signature_md(EVP_PKEY_CTX *ctx, const EVP_MD *md)\n{\n    OSSL_PARAM sig_md_params[3], *p = sig_md_params;\n    size_t mdsize;\n    const char *name;\n    if (ctx == NULL || !EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx)) {\n        ERR_raise(ERR_LIB_EVP, EVP_R_COMMAND_NOT_SUPPORTED);\n        return -2;\n    }\n    if (ctx->op.sig.sigprovctx == NULL)\n        return EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG,\n                                 EVP_PKEY_CTRL_MD, 0, (void *)(md));\n    if (md == NULL) {\n        name = "";\n        mdsize = 0;\n    } else {\n        mdsize = EVP_MD_size(md);\n        name = EVP_MD_name(md);\n    }\n    *p++ = OSSL_PARAM_construct_utf8_string(OSSL_SIGNATURE_PARAM_DIGEST,\n                                            (char *)name,\n                                            strlen(name) + 1);\n    *p++ = OSSL_PARAM_construct_size_t(OSSL_SIGNATURE_PARAM_DIGEST_SIZE,\n                                       &mdsize);\n    *p++ = OSSL_PARAM_construct_end();\n    return EVP_PKEY_CTX_set_params(ctx, sig_md_params);\n}', 'const char *EVP_MD_name(const EVP_MD *md)\n{\n    if (md->prov != NULL)\n        return md->name;\n#ifndef FIPS_MODE\n    return OBJ_nid2sn(EVP_MD_nid(md));\n#else\n    return NULL;\n#endif\n}']