apps/x509.c:1033: error: NULL_DEREFERENCE
  pointer `pktmp` last assigned on line 1031 could be null and is dereferenced by call to `EVP_PKEY_save_parameters()` at line 1033, column 2.
Showing all 11 steps of the trace


apps/x509.c:1026:1: start of procedure sign()
1024.   
1025.   /* self sign */
1026. > static int sign(X509 *x, EVP_PKEY *pkey, int days, const EVP_MD *digest)
1027.   	{
1028.   

apps/x509.c:1031:2: 
1029.   	EVP_PKEY *pktmp;
1030.   
1031. > 	pktmp = X509_get_pubkey(x);
1032.   	EVP_PKEY_copy_parameters(pktmp,pkey);
1033.   	EVP_PKEY_save_parameters(pktmp,1);

crypto/x509/x509_cmp.c:237:1: start of procedure X509_get_pubkey()
  235.   	}
  236.   
  237. > EVP_PKEY *X509_get_pubkey(X509 *x)
  238.   	{
  239.   	if ((x == NULL) || (x->cert_info == NULL))

crypto/x509/x509_cmp.c:239:7: Taking false branch
  237.   EVP_PKEY *X509_get_pubkey(X509 *x)
  238.   	{
  239.   	if ((x == NULL) || (x->cert_info == NULL))
               ^
  240.   		return(NULL);
  241.   	return(X509_PUBKEY_get(x->cert_info->key));

crypto/x509/x509_cmp.c:239:22: Taking true branch
  237.   EVP_PKEY *X509_get_pubkey(X509 *x)
  238.   	{
  239.   	if ((x == NULL) || (x->cert_info == NULL))
                              ^
  240.   		return(NULL);
  241.   	return(X509_PUBKEY_get(x->cert_info->key));

crypto/x509/x509_cmp.c:240:3: 
  238.   	{
  239.   	if ((x == NULL) || (x->cert_info == NULL))
  240. > 		return(NULL);
  241.   	return(X509_PUBKEY_get(x->cert_info->key));
  242.   	}

crypto/x509/x509_cmp.c:242:2: return from a call to X509_get_pubkey
  240.   		return(NULL);
  241.   	return(X509_PUBKEY_get(x->cert_info->key));
  242.   	}
          ^
  243.   
  244.   int X509_check_private_key(X509 *x, EVP_PKEY *k)

apps/x509.c:1032:2: Skipping EVP_PKEY_copy_parameters(): empty list of specs
1030.   
1031.   	pktmp = X509_get_pubkey(x);
1032.   	EVP_PKEY_copy_parameters(pktmp,pkey);
         ^
1033.   	EVP_PKEY_save_parameters(pktmp,1);
1034.   	EVP_PKEY_free(pktmp);

apps/x509.c:1033:2: 
1031.   	pktmp = X509_get_pubkey(x);
1032.   	EVP_PKEY_copy_parameters(pktmp,pkey);
1033. > 	EVP_PKEY_save_parameters(pktmp,1);
1034.   	EVP_PKEY_free(pktmp);
1035.   

crypto/evp/p_lib.c:105:1: start of procedure EVP_PKEY_save_parameters()
  103.   	}
  104.   
  105. > int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode)
  106.   	{
  107.   #ifndef NO_DSA

crypto/evp/p_lib.c:108:6: 
  106.   	{
  107.   #ifndef NO_DSA
  108. > 	if (pkey->type == EVP_PKEY_DSA)
  109.   		{
  110.   		int ret=pkey->save_parameters=mode;

static int sign(X509 *x, EVP_PKEY *pkey, int days, const EVP_MD *digest)
	{
	EVP_PKEY *pktmp;
	pktmp = X509_get_pubkey(x);
	EVP_PKEY_copy_parameters(pktmp,pkey);
	EVP_PKEY_save_parameters(pktmp,1);
	EVP_PKEY_free(pktmp);
	if (!X509_set_issuer_name(x,X509_get_subject_name(x))) goto err;
	if (X509_gmtime_adj(X509_get_notBefore(x),0) == NULL) goto err;
	if (X509_gmtime_adj(X509_get_notAfter(x),(long)60*60*24*days) == NULL)
		goto err;
	if (!X509_set_pubkey(x,pkey)) goto err;
	if (!X509_sign(x,pkey,digest)) goto err;
	return(1);
err:
	ERR_print_errors(bio_err);
	return(0);
	}
['static int sign(X509 *x, EVP_PKEY *pkey, int days, const EVP_MD *digest)\n\t{\n\tEVP_PKEY *pktmp;\n\tpktmp = X509_get_pubkey(x);\n\tEVP_PKEY_copy_parameters(pktmp,pkey);\n\tEVP_PKEY_save_parameters(pktmp,1);\n\tEVP_PKEY_free(pktmp);\n\tif (!X509_set_issuer_name(x,X509_get_subject_name(x))) goto err;\n\tif (X509_gmtime_adj(X509_get_notBefore(x),0) == NULL) goto err;\n\tif (X509_gmtime_adj(X509_get_notAfter(x),(long)60*60*24*days) == NULL)\n\t\tgoto err;\n\tif (!X509_set_pubkey(x,pkey)) goto err;\n\tif (!X509_sign(x,pkey,digest)) goto err;\n\treturn(1);\nerr:\n\tERR_print_errors(bio_err);\n\treturn(0);\n\t}', 'EVP_PKEY *X509_get_pubkey(X509 *x)\n\t{\n\tif ((x == NULL) || (x->cert_info == NULL))\n\t\treturn(NULL);\n\treturn(X509_PUBKEY_get(x->cert_info->key));\n\t}', 'int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode)\n\t{\n#ifndef NO_DSA\n\tif (pkey->type == EVP_PKEY_DSA)\n\t\t{\n\t\tint ret=pkey->save_parameters=mode;\n\t\tif (mode >= 0)\n\t\t\tpkey->save_parameters=mode;\n\t\treturn(ret);\n\t\t}\n#endif\n\treturn(0);\n\t}']