crypto/hmac/hm_ameth.c:130: error: NULL_DEREFERENCE
  pointer `*pder` last assigned on line 125 could be null and is dereferenced by call to `memcpy()` at line 130, column 3.
Showing all 12 steps of the trace


crypto/hmac/hm_ameth.c:117:1: start of procedure old_hmac_encode()
115.   	}
116.   
117. > static int old_hmac_encode(const EVP_PKEY *pkey, unsigned char **pder)
118.   	{
119.   	int inc;

crypto/hmac/hm_ameth.c:120:2: 
118.   	{
119.   	int inc;
120. > 	ASN1_OCTET_STRING *os = (ASN1_OCTET_STRING *)pkey->pkey.ptr;
121.   	if (pder)
122.   		{

crypto/hmac/hm_ameth.c:121:6: Taking true branch
119.   	int inc;
120.   	ASN1_OCTET_STRING *os = (ASN1_OCTET_STRING *)pkey->pkey.ptr;
121.   	if (pder)
            ^
122.   		{
123.   		if (!*pder)

crypto/hmac/hm_ameth.c:123:8: Taking true branch
121.   	if (pder)
122.   		{
123.   		if (!*pder)
              ^
124.   			{
125.   			*pder = OPENSSL_malloc(os->length);

crypto/hmac/hm_ameth.c:125:4: 
123.   		if (!*pder)
124.   			{
125. > 			*pder = OPENSSL_malloc(os->length);
126.   			inc = 0;
127.   			}

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 true branch
  297.   	void *ret = NULL;
  298.   
  299.   	if (num <= 0) return NULL;
              ^
  300.   
  301.   	allow_customize = 0;

crypto/mem.c:299:16: 
  297.   	void *ret = NULL;
  298.   
  299. > 	if (num <= 0) return NULL;
  300.   
  301.   	allow_customize = 0;

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.   	{

crypto/hmac/hm_ameth.c:126:4: 
124.   			{
125.   			*pder = OPENSSL_malloc(os->length);
126. > 			inc = 0;
127.   			}
128.   		else inc = 1;

crypto/hmac/hm_ameth.c:130:3: 
128.   		else inc = 1;
129.   
130. > 		memcpy(*pder, os->data, os->length);
131.   
132.   		if (inc)

static int old_hmac_encode(const EVP_PKEY *pkey, unsigned char **pder)
	{
	int inc;
	ASN1_OCTET_STRING *os = (ASN1_OCTET_STRING *)pkey->pkey.ptr;
	if (pder)
		{
		if (!*pder)
			{
			*pder = OPENSSL_malloc(os->length);
			inc = 0;
			}
		else inc = 1;
		memcpy(*pder, os->data, os->length);
		if (inc)
			*pder += os->length;
		}
	return os->length;
	}
['static int old_hmac_encode(const EVP_PKEY *pkey, unsigned char **pder)\n\t{\n\tint inc;\n\tASN1_OCTET_STRING *os = (ASN1_OCTET_STRING *)pkey->pkey.ptr;\n\tif (pder)\n\t\t{\n\t\tif (!*pder)\n\t\t\t{\n\t\t\t*pder = OPENSSL_malloc(os->length);\n\t\t\tinc = 0;\n\t\t\t}\n\t\telse inc = 1;\n\t\tmemcpy(*pder, os->data, os->length);\n\t\tif (inc)\n\t\t\t*pder += os->length;\n\t\t}\n\treturn os->length;\n\t}', 'void *CRYPTO_malloc(int num, const char *file, int line)\n\t{\n\tvoid *ret = NULL;\n\tif (num <= 0) return NULL;\n\tallow_customize = 0;\n\tif (malloc_debug_func != NULL)\n\t\t{\n\t\tallow_customize_debug = 0;\n\t\tmalloc_debug_func(NULL, num, file, line, 0);\n\t\t}\n\tret = malloc_ex_func(num,file,line);\n#ifdef LEVITTE_DEBUG_MEM\n\tfprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\\n", ret, num);\n#endif\n\tif (malloc_debug_func != NULL)\n\t\tmalloc_debug_func(ret, num, file, line, 1);\n#ifndef OPENSSL_CPUID_OBJ\n        if(ret && (num > 2048))\n\t{\textern unsigned char cleanse_ctr;\n                ((unsigned char *)ret)[0] = cleanse_ctr;\n\t}\n#endif\n\treturn ret;\n\t}']