crypto/evp/evp_pbe.c:98: error: NULL_DEREFERENCE
  pointer `pbetmp` last assigned on line 97 could be null and is dereferenced at line 98, column 8.
Showing all 32 steps of the trace


crypto/evp/evp_pbe.c:77:1: start of procedure EVP_PBE_CipherInit()
75.   } EVP_PBE_CTL;
76.   
77. > int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
78.   	     ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de)
79.   {

crypto/evp/evp_pbe.c:83:2: 
81.   	EVP_PBE_CTL *pbetmp, pbelu;
82.   	int i;
83. > 	pbelu.pbe_nid = OBJ_obj2nid(pbe_obj);
84.   	if (pbelu.pbe_nid != NID_undef) i = sk_find(pbe_algs, (char *)&pbelu);
85.   	else i = -1;

crypto/objects/obj_dat.c:363:1: start of procedure OBJ_obj2nid()
  361.   	}
  362.   
  363. > int OBJ_obj2nid(const ASN1_OBJECT *a)
  364.   	{
  365.   	ASN1_OBJECT **op;

crypto/objects/obj_dat.c:368:6: Taking false branch
  366.   	ADDED_OBJ ad,*adp;
  367.   
  368.   	if (a == NULL)
              ^
  369.   		return(NID_undef);
  370.   	if (a->nid != 0)

crypto/objects/obj_dat.c:370:6: Taking false branch
  368.   	if (a == NULL)
  369.   		return(NID_undef);
  370.   	if (a->nid != 0)
              ^
  371.   		return(a->nid);
  372.   

crypto/objects/obj_dat.c:373:6: Taking true branch
  371.   		return(a->nid);
  372.   
  373.   	if (added != NULL)
              ^
  374.   		{
  375.   		ad.type=ADDED_DATA;

crypto/objects/obj_dat.c:375:3: 
  373.   	if (added != NULL)
  374.   		{
  375. > 		ad.type=ADDED_DATA;
  376.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  377.   		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);

crypto/objects/obj_dat.c:376:3: 
  374.   		{
  375.   		ad.type=ADDED_DATA;
  376. > 		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  377.   		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
  378.   		if (adp != NULL) return (adp->obj->nid);

crypto/objects/obj_dat.c:377:3: 
  375.   		ad.type=ADDED_DATA;
  376.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  377. > 		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
  378.   		if (adp != NULL) return (adp->obj->nid);
  379.   		}

crypto/lhash/lhash.c:248:1: start of procedure lh_retrieve()
    246.   	}
    247.   
    248. > void *lh_retrieve(LHASH *lh, const void *data)
    249.   	{
    250.   	unsigned long hash;

crypto/lhash/lhash.c:254:2: 
    252.   	const void *ret;
    253.   
    254. > 	lh->error=0;
    255.   	rn=getrn(lh,data,&hash);
    256.   

crypto/lhash/lhash.c:255:2: Skipping getrn(): empty list of specs
    253.   
    254.   	lh->error=0;
    255.   	rn=getrn(lh,data,&hash);
            ^
    256.   
    257.   	if (*rn == NULL)

crypto/lhash/lhash.c:257:6: Taking false branch
    255.   	rn=getrn(lh,data,&hash);
    256.   
    257.   	if (*rn == NULL)
                ^
    258.   		{
    259.   		lh->num_retrieve_miss++;

crypto/lhash/lhash.c:264:3: 
    262.   	else
    263.   		{
    264. > 		ret= (*rn)->data;
    265.   		lh->num_retrieve++;
    266.   		}

crypto/lhash/lhash.c:265:3: 
    263.   		{
    264.   		ret= (*rn)->data;
    265. > 		lh->num_retrieve++;
    266.   		}
    267.   	return((void *)ret);

crypto/lhash/lhash.c:267:2: 
    265.   		lh->num_retrieve++;
    266.   		}
    267. > 	return((void *)ret);
    268.   	}
    269.   

crypto/lhash/lhash.c:268:2: return from a call to lh_retrieve
    266.   		}
    267.   	return((void *)ret);
    268.   	}
            ^
    269.   
    270.   static void doall_util_fn(LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,

crypto/objects/obj_dat.c:378:7: Taking true branch
  376.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  377.   		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
  378.   		if (adp != NULL) return (adp->obj->nid);
               ^
  379.   		}
  380.   	op=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ,

crypto/objects/obj_dat.c:378:20: 
  376.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
  377.   		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
  378. > 		if (adp != NULL) return (adp->obj->nid);
  379.   		}
  380.   	op=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ,

crypto/objects/obj_dat.c:385:2: return from a call to OBJ_obj2nid
  383.   		return(NID_undef);
  384.   	return((*op)->nid);
  385.   	}
          ^
  386.   
  387.   /* Convert an object name into an ASN1_OBJECT

crypto/evp/evp_pbe.c:84:6: Taking true branch
82.   	int i;
83.   	pbelu.pbe_nid = OBJ_obj2nid(pbe_obj);
84.   	if (pbelu.pbe_nid != NID_undef) i = sk_find(pbe_algs, (char *)&pbelu);
           ^
85.   	else i = -1;
86.   

crypto/evp/evp_pbe.c:84:34: Skipping sk_find(): empty list of specs
82.   	int i;
83.   	pbelu.pbe_nid = OBJ_obj2nid(pbe_obj);
84.   	if (pbelu.pbe_nid != NID_undef) i = sk_find(pbe_algs, (char *)&pbelu);
                                       ^
85.   	else i = -1;
86.   

crypto/evp/evp_pbe.c:87:6: Taking false branch
85.   	else i = -1;
86.   
87.   	if (i == -1) {
           ^
88.   		char obj_tmp[80];
89.   		EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_UNKNOWN_PBE_ALGORITHM);

crypto/evp/evp_pbe.c:95:6: Taking false branch
93.   		return 0;
94.   	}
95.   	if(!pass) passlen = 0;
           ^
96.   	else if (passlen == -1) passlen = strlen(pass);
97.   	pbetmp = (EVP_PBE_CTL *)sk_value (pbe_algs, i);

crypto/evp/evp_pbe.c:96:11: Taking true branch
94.   	}
95.   	if(!pass) passlen = 0;
96.   	else if (passlen == -1) passlen = strlen(pass);
                ^
97.   	pbetmp = (EVP_PBE_CTL *)sk_value (pbe_algs, i);
98.   	i = (*pbetmp->keygen)(ctx, pass, passlen, param, pbetmp->cipher,

crypto/evp/evp_pbe.c:96:26: 
94.   	}
95.   	if(!pass) passlen = 0;
96. > 	else if (passlen == -1) passlen = strlen(pass);
97.   	pbetmp = (EVP_PBE_CTL *)sk_value (pbe_algs, i);
98.   	i = (*pbetmp->keygen)(ctx, pass, passlen, param, pbetmp->cipher,

crypto/evp/evp_pbe.c:97:2: 
95.   	if(!pass) passlen = 0;
96.   	else if (passlen == -1) passlen = strlen(pass);
97. > 	pbetmp = (EVP_PBE_CTL *)sk_value (pbe_algs, i);
98.   	i = (*pbetmp->keygen)(ctx, pass, passlen, param, pbetmp->cipher,
99.   						 pbetmp->md, en_de);

crypto/stack/stack.c:305:1: start of procedure sk_value()
  303.   }
  304.   
  305. > char *sk_value(const STACK *st, int i)
  306.   {
  307.   	if(st == NULL) return NULL;

crypto/stack/stack.c:307:5: Taking true branch
  305.   char *sk_value(const STACK *st, int i)
  306.   {
  307.   	if(st == NULL) return NULL;
             ^
  308.   	return st->data[i];
  309.   }

crypto/stack/stack.c:307:17: 
  305.   char *sk_value(const STACK *st, int i)
  306.   {
  307. > 	if(st == NULL) return NULL;
  308.   	return st->data[i];
  309.   }

crypto/stack/stack.c:309:1: return from a call to sk_value
  307.   	if(st == NULL) return NULL;
  308.   	return st->data[i];
  309. > }
  310.   
  311.   char *sk_set(STACK *st, int i, char *value)

crypto/evp/evp_pbe.c:98:2: 
96.   	else if (passlen == -1) passlen = strlen(pass);
97.   	pbetmp = (EVP_PBE_CTL *)sk_value (pbe_algs, i);
98. > 	i = (*pbetmp->keygen)(ctx, pass, passlen, param, pbetmp->cipher,
99.   						 pbetmp->md, en_de);
100.   	if (!i) {

int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
	     ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de)
{
	EVP_PBE_CTL *pbetmp, pbelu;
	int i;
	pbelu.pbe_nid = OBJ_obj2nid(pbe_obj);
	if (pbelu.pbe_nid != NID_undef) i = sk_find(pbe_algs, (char *)&pbelu);
	else i = -1;
	if (i == -1) {
		char obj_tmp[80];
		EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_UNKNOWN_PBE_ALGORITHM);
		if (!pbe_obj) strcpy (obj_tmp, "NULL");
		else i2t_ASN1_OBJECT(obj_tmp, 80, pbe_obj);
		ERR_add_error_data(2, "TYPE=", obj_tmp);
		return 0;
	}
	if(!pass) passlen = 0;
	else if (passlen == -1) passlen = strlen(pass);
	pbetmp = (EVP_PBE_CTL *)sk_value (pbe_algs, i);
	i = (*pbetmp->keygen)(ctx, pass, passlen, param, pbetmp->cipher,
						 pbetmp->md, en_de);
	if (!i) {
		EVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_KEYGEN_FAILURE);
		return 0;
	}
	return 1;
}
['int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen,\n\t     ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de)\n{\n\tEVP_PBE_CTL *pbetmp, pbelu;\n\tint i;\n\tpbelu.pbe_nid = OBJ_obj2nid(pbe_obj);\n\tif (pbelu.pbe_nid != NID_undef) i = sk_find(pbe_algs, (char *)&pbelu);\n\telse i = -1;\n\tif (i == -1) {\n\t\tchar obj_tmp[80];\n\t\tEVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_UNKNOWN_PBE_ALGORITHM);\n\t\tif (!pbe_obj) strcpy (obj_tmp, "NULL");\n\t\telse i2t_ASN1_OBJECT(obj_tmp, 80, pbe_obj);\n\t\tERR_add_error_data(2, "TYPE=", obj_tmp);\n\t\treturn 0;\n\t}\n\tif(!pass) passlen = 0;\n\telse if (passlen == -1) passlen = strlen(pass);\n\tpbetmp = (EVP_PBE_CTL *)sk_value (pbe_algs, i);\n\ti = (*pbetmp->keygen)(ctx, pass, passlen, param, pbetmp->cipher,\n\t\t\t\t\t\t pbetmp->md, en_de);\n\tif (!i) {\n\t\tEVPerr(EVP_F_EVP_PBE_CIPHERINIT,EVP_R_KEYGEN_FAILURE);\n\t\treturn 0;\n\t}\n\treturn 1;\n}', 'int OBJ_obj2nid(const ASN1_OBJECT *a)\n\t{\n\tASN1_OBJECT **op;\n\tADDED_OBJ ad,*adp;\n\tif (a == NULL)\n\t\treturn(NID_undef);\n\tif (a->nid != 0)\n\t\treturn(a->nid);\n\tif (added != NULL)\n\t\t{\n\t\tad.type=ADDED_DATA;\n\t\tad.obj=(ASN1_OBJECT *)a;\n\t\tadp=(ADDED_OBJ *)lh_retrieve(added,&ad);\n\t\tif (adp != NULL) return (adp->obj->nid);\n\t\t}\n\top=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ,\n\t\tsizeof(ASN1_OBJECT *),obj_cmp);\n\tif (op == NULL)\n\t\treturn(NID_undef);\n\treturn((*op)->nid);\n\t}', 'void *lh_retrieve(LHASH *lh, const void *data)\n\t{\n\tunsigned long hash;\n\tLHASH_NODE **rn;\n\tconst void *ret;\n\tlh->error=0;\n\trn=getrn(lh,data,&hash);\n\tif (*rn == NULL)\n\t\t{\n\t\tlh->num_retrieve_miss++;\n\t\treturn(NULL);\n\t\t}\n\telse\n\t\t{\n\t\tret= (*rn)->data;\n\t\tlh->num_retrieve++;\n\t\t}\n\treturn((void *)ret);\n\t}', 'char *sk_value(const STACK *st, int i)\n{\n\tif(st == NULL) return NULL;\n\treturn st->data[i];\n}']