crypto/evp/evp_lib.c:327: error: NULL_DEREFERENCE
  pointer `to` last assigned on line 325 could be null and is dereferenced by call to `memcpy()` at line 327, column 9.
Showing all 23 steps of the trace


crypto/evp/evp_lib.c:323:1: start of procedure EVP_MD_meth_dup()
321.       return md;
322.   }
323. > EVP_MD *EVP_MD_meth_dup(const EVP_MD *md)
324.   {
325.       EVP_MD *to = EVP_MD_meth_new(md->type, md->pkey_type);

crypto/evp/evp_lib.c:325:5: 
323.   EVP_MD *EVP_MD_meth_dup(const EVP_MD *md)
324.   {
325. >     EVP_MD *to = EVP_MD_meth_new(md->type, md->pkey_type);
326.       if (md != NULL)
327.           memcpy(to, md, sizeof(*to));

crypto/evp/evp_lib.c:314:1: start of procedure EVP_MD_meth_new()
  312.   }
  313.   
  314. > EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type)
  315.   {
  316.       EVP_MD *md = (EVP_MD *)OPENSSL_zalloc(sizeof(EVP_MD));

crypto/evp/evp_lib.c:316:5: 
  314.   EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type)
  315.   {
  316. >     EVP_MD *md = (EVP_MD *)OPENSSL_zalloc(sizeof(EVP_MD));
  317.       if (md != NULL) {
  318.           md->type = md_type;

crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
    155.   }
    156.   
    157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    158.   {
    159.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:159:5: 
    157.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    158.   {
    159. >     void *ret = CRYPTO_malloc(num, file, line);
    160.   
    161.       if (ret != NULL)

crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
      118.   }
      119.   
      120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      121.   {
      122.       void *ret = NULL;

crypto/mem.c:122:5: 
      120.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      121.   {
      122. >     void *ret = NULL;
      123.   
      124.       if (num <= 0)

crypto/mem.c:124:9: Taking false branch
      122.       void *ret = NULL;
      123.   
      124.       if (num <= 0)
                     ^
      125.           return NULL;
      126.   

crypto/mem.c:127:5: 
      125.           return NULL;
      126.   
      127. >     allow_customize = 0;
      128.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      129.       if (call_malloc_debug) {

crypto/mem.c:137:5: 
      135.       }
      136.   #else
      137. >     (void)file;
      138.       (void)line;
      139.       ret = malloc(num);

crypto/mem.c:138:5: 
      136.   #else
      137.       (void)file;
      138. >     (void)line;
      139.       ret = malloc(num);
      140.   #endif

crypto/mem.c:139:5: 
      137.       (void)file;
      138.       (void)line;
      139. >     ret = malloc(num);
      140.   #endif
      141.   

crypto/mem.c:154:5: 
      152.   #endif
      153.   
      154. >     return ret;
      155.   }
      156.   

crypto/mem.c:155:1: return from a call to CRYPTO_malloc
      153.   
      154.       return ret;
      155. > }
      156.   
      157.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:161:9: Taking false branch
    159.       void *ret = CRYPTO_malloc(num, file, line);
    160.   
    161.       if (ret != NULL)
                   ^
    162.           memset(ret, 0, num);
    163.       return ret;

crypto/mem.c:163:5: 
    161.       if (ret != NULL)
    162.           memset(ret, 0, num);
    163. >     return ret;
    164.   }
    165.   

crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
    162.           memset(ret, 0, num);
    163.       return ret;
    164. > }
    165.   
    166.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/evp/evp_lib.c:317:9: Taking false branch
  315.   {
  316.       EVP_MD *md = (EVP_MD *)OPENSSL_zalloc(sizeof(EVP_MD));
  317.       if (md != NULL) {
                 ^
  318.           md->type = md_type;
  319.           md->pkey_type = pkey_type;

crypto/evp/evp_lib.c:321:5: 
  319.           md->pkey_type = pkey_type;
  320.       }
  321. >     return md;
  322.   }
  323.   EVP_MD *EVP_MD_meth_dup(const EVP_MD *md)

crypto/evp/evp_lib.c:322:1: return from a call to EVP_MD_meth_new
  320.       }
  321.       return md;
  322. > }
  323.   EVP_MD *EVP_MD_meth_dup(const EVP_MD *md)
  324.   {

crypto/evp/evp_lib.c:326:9: Taking true branch
324.   {
325.       EVP_MD *to = EVP_MD_meth_new(md->type, md->pkey_type);
326.       if (md != NULL)
               ^
327.           memcpy(to, md, sizeof(*to));
328.       return to;

crypto/evp/evp_lib.c:327:9: 
325.       EVP_MD *to = EVP_MD_meth_new(md->type, md->pkey_type);
326.       if (md != NULL)
327. >         memcpy(to, md, sizeof(*to));
328.       return to;
329.   }
