engines/ccgost/gost_pmeth.c:560: error: NULL_DEREFERENCE
  pointer `keydata` last assigned on line 559 could be null and is dereferenced by call to `memcpy()` at line 560, column 3.
Showing all 21 steps of the trace


engines/ccgost/gost_pmeth.c:550:1: start of procedure pkey_gost_mac_keygen()
548.   	}	
549.   
550. > static int pkey_gost_mac_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
551.   	{
552.   		struct gost_mac_pmeth_data *data = EVP_PKEY_CTX_get_data(ctx);

engines/ccgost/gost_pmeth.c:552:3: 
550.   static int pkey_gost_mac_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
551.   	{
552. > 		struct gost_mac_pmeth_data *data = EVP_PKEY_CTX_get_data(ctx);
553.   		unsigned char *keydata;
554.   		if (!data->key_set) 

crypto/evp/pmeth_lib.c:460:1: start of procedure EVP_PKEY_CTX_get_data()
  458.   	}
  459.   
  460. > void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx)
  461.   	{
  462.   	return ctx->data;

crypto/evp/pmeth_lib.c:462:2: 
  460.   void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx)
  461.   	{
  462. > 	return ctx->data;
  463.   	}
  464.   

crypto/evp/pmeth_lib.c:463:2: return from a call to EVP_PKEY_CTX_get_data
  461.   	{
  462.   	return ctx->data;
  463.   	}
          ^
  464.   
  465.   EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx)

engines/ccgost/gost_pmeth.c:554:8: Taking false branch
552.   		struct gost_mac_pmeth_data *data = EVP_PKEY_CTX_get_data(ctx);
553.   		unsigned char *keydata;
554.   		if (!data->key_set) 
              ^
555.   		{
556.   			GOSTerr(GOST_F_PKEY_GOST_MAC_KEYGEN,GOST_R_MAC_KEY_NOT_SET);

engines/ccgost/gost_pmeth.c:559:3: 
557.   			return 0;
558.   		}
559. > 		keydata = OPENSSL_malloc(32);
560.   		memcpy(keydata,data->key,32);
561.   		EVP_PKEY_assign(pkey, NID_id_Gost28147_89_MAC, keydata);

crypto/mem.c:295:1: start of procedure CRYPTO_malloc()
  293.   	}
  294.   
  295. > void *CRYPTO_malloc(int num, const char *file, int line)
  296.   	{
  297.   	void *ret = NULL;

crypto/mem.c:297:2: 
  295.   void *CRYPTO_malloc(int num, const char *file, int line)
  296.   	{
  297. > 	void *ret = NULL;
  298.   
  299.   	if (num <= 0) return NULL;

crypto/mem.c:299:6: Taking false branch
  297.   	void *ret = NULL;
  298.   
  299.   	if (num <= 0) return NULL;
              ^
  300.   
  301.   	allow_customize = 0;

crypto/mem.c:301:2: 
  299.   	if (num <= 0) return NULL;
  300.   
  301. > 	allow_customize = 0;
  302.   	if (malloc_debug_func != NULL)
  303.   		{

crypto/mem.c:302:6: Taking true branch
  300.   
  301.   	allow_customize = 0;
  302.   	if (malloc_debug_func != NULL)
              ^
  303.   		{
  304.   		allow_customize_debug = 0;

crypto/mem.c:304:3: 
  302.   	if (malloc_debug_func != NULL)
  303.   		{
  304. > 		allow_customize_debug = 0;
  305.   		malloc_debug_func(NULL, num, file, line, 0);
  306.   		}

crypto/mem.c:305:3: Skipping __function_pointer__(): unresolved function pointer
  303.   		{
  304.   		allow_customize_debug = 0;
  305.   		malloc_debug_func(NULL, num, file, line, 0);
           ^
  306.   		}
  307.   	ret = malloc_ex_func(num,file,line);

crypto/mem.c:307:2: Skipping __function_pointer__(): unresolved function pointer
  305.   		malloc_debug_func(NULL, num, file, line, 0);
  306.   		}
  307.   	ret = malloc_ex_func(num,file,line);
          ^
  308.   #ifdef LEVITTE_DEBUG_MEM
  309.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);

crypto/mem.c:311:6: Taking true branch
  309.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
  310.   #endif
  311.   	if (malloc_debug_func != NULL)
              ^
  312.   		malloc_debug_func(ret, num, file, line, 1);
  313.   

crypto/mem.c:312:3: Skipping __function_pointer__(): unresolved function pointer
  310.   #endif
  311.   	if (malloc_debug_func != NULL)
  312.   		malloc_debug_func(ret, num, file, line, 1);
           ^
  313.   
  314.   #ifndef OPENSSL_CPUID_OBJ

crypto/mem.c:318:12: Taking false branch
  316.            * sanitisation function can't be optimised out. NB: We only do
  317.            * this for >2Kb so the overhead doesn't bother us. */
  318.           if(ret && (num > 2048))
                    ^
  319.   	{	extern unsigned char cleanse_ctr;
  320.                   ((unsigned char *)ret)[0] = cleanse_ctr;

crypto/mem.c:324:2: 
  322.   #endif
  323.   
  324. > 	return ret;
  325.   	}
  326.   char *CRYPTO_strdup(const char *str, const char *file, int line)

crypto/mem.c:325:2: return from a call to CRYPTO_malloc
  323.   
  324.   	return ret;
  325.   	}
          ^
  326.   char *CRYPTO_strdup(const char *str, const char *file, int line)
  327.   	{

engines/ccgost/gost_pmeth.c:560:3: 
558.   		}
559.   		keydata = OPENSSL_malloc(32);
560. > 		memcpy(keydata,data->key,32);
561.   		EVP_PKEY_assign(pkey, NID_id_Gost28147_89_MAC, keydata);
562.   		return 1;
