crypto/x509/x509_lu.c:297: error: NULL_DEREFERENCE
  pointer `lu` last assigned on line 296 could be null and is dereferenced by call to `X509_LOOKUP_by_subject()` at line 297, column 6.
Showing all 37 steps of the trace


crypto/x509/x509_lu.c:282:1: start of procedure X509_STORE_get_by_subject()
280.   	}
281.   
282. > int X509_STORE_get_by_subject(X509_STORE_CTX *vs, int type, X509_NAME *name,
283.   	     X509_OBJECT *ret)
284.   	{

crypto/x509/x509_lu.c:285:2: 
283.   	     X509_OBJECT *ret)
284.   	{
285. > 	X509_STORE *ctx=vs->ctx;
286.   	X509_LOOKUP *lu;
287.   	X509_OBJECT stmp,*tmp;

crypto/x509/x509_lu.c:290:2: 
288.   	int i,j;
289.   
290. > 	tmp=X509_OBJECT_retrieve_by_subject(ctx->objs,type,name);
291.   
292.   	if (tmp == NULL)

crypto/x509/x509_lu.c:448:1: start of procedure X509_OBJECT_retrieve_by_subject()
  446.   	}
  447.   
  448. > X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, int type,
  449.   	     X509_NAME *name)
  450.   {

crypto/x509/x509_lu.c:452:2: 
  450.   {
  451.   	int idx;
  452. > 	idx = X509_OBJECT_idx_by_subject(h, type, name);
  453.   	if (idx==-1) return NULL;
  454.   	return sk_X509_OBJECT_value(h, idx);

crypto/x509/x509_lu.c:418:1: start of procedure X509_OBJECT_idx_by_subject()
    416.   	}
    417.   
    418. > int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type,
    419.   	     X509_NAME *name)
    420.   	{

crypto/x509/x509_lu.c:427:2: 
    425.   	X509_CRL_INFO crl_info_s;
    426.   
    427. > 	stmp.type=type;
    428.   	switch (type)
    429.   		{

crypto/x509/x509_lu.c:428:2: 
    426.   
    427.   	stmp.type=type;
    428. > 	switch (type)
    429.   		{
    430.   	case X509_LU_X509:

crypto/x509/x509_lu.c:430:2: Switch condition is true. Entering switch case
    428.   	switch (type)
    429.   		{
    430.   	case X509_LU_X509:
            ^
    431.   		stmp.data.x509= &x509_s;
    432.   		x509_s.cert_info= &cinf_s;

crypto/x509/x509_lu.c:431:3: 
    429.   		{
    430.   	case X509_LU_X509:
    431. > 		stmp.data.x509= &x509_s;
    432.   		x509_s.cert_info= &cinf_s;
    433.   		cinf_s.subject=name;

crypto/x509/x509_lu.c:432:3: 
    430.   	case X509_LU_X509:
    431.   		stmp.data.x509= &x509_s;
    432. > 		x509_s.cert_info= &cinf_s;
    433.   		cinf_s.subject=name;
    434.   		break;

crypto/x509/x509_lu.c:433:3: 
    431.   		stmp.data.x509= &x509_s;
    432.   		x509_s.cert_info= &cinf_s;
    433. > 		cinf_s.subject=name;
    434.   		break;
    435.   	case X509_LU_CRL:

crypto/x509/x509_lu.c:445:2: Skipping sk_find(): empty list of specs
    443.   		}
    444.   
    445.   	return sk_X509_OBJECT_find(h,&stmp);
            ^
    446.   	}
    447.   

crypto/x509/x509_lu.c:446:2: return from a call to X509_OBJECT_idx_by_subject
    444.   
    445.   	return sk_X509_OBJECT_find(h,&stmp);
    446.   	}
            ^
    447.   
    448.   X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, int type,

crypto/x509/x509_lu.c:453:6: Taking false branch
  451.   	int idx;
  452.   	idx = X509_OBJECT_idx_by_subject(h, type, name);
  453.   	if (idx==-1) return NULL;
              ^
  454.   	return sk_X509_OBJECT_value(h, idx);
  455.   }

crypto/x509/x509_lu.c:454:2: 
  452.   	idx = X509_OBJECT_idx_by_subject(h, type, name);
  453.   	if (idx==-1) return NULL;
  454. > 	return sk_X509_OBJECT_value(h, idx);
  455.   }
  456.   

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

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

crypto/stack/stack.c:310:2: 
    308.   {
    309.   	if(st == NULL) return NULL;
    310. > 	return st->data[i];
    311.   }
    312.   

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

crypto/x509/x509_lu.c:455:1: return from a call to X509_OBJECT_retrieve_by_subject
  453.   	if (idx==-1) return NULL;
  454.   	return sk_X509_OBJECT_value(h, idx);
  455. > }
  456.   
  457.   X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x)

crypto/x509/x509_lu.c:292:6: Taking true branch
290.   	tmp=X509_OBJECT_retrieve_by_subject(ctx->objs,type,name);
291.   
292.   	if (tmp == NULL)
            ^
293.   		{
294.   		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)

crypto/x509/x509_lu.c:294:8: 
292.   	if (tmp == NULL)
293.   		{
294. > 		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
295.   			{
296.   			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);

crypto/x509/x509_lu.c:294:30: 
292.   	if (tmp == NULL)
293.   		{
294. > 		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
295.   			{
296.   			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);

crypto/stack/stack.c:301:1: start of procedure sk_num()
  299.   	}
  300.   
  301. > int sk_num(const STACK *st)
  302.   {
  303.   	if(st == NULL) return -1;

crypto/stack/stack.c:303:5: Taking true branch
  301.   int sk_num(const STACK *st)
  302.   {
  303.   	if(st == NULL) return -1;
             ^
  304.   	return st->num;
  305.   }

crypto/stack/stack.c:303:17: 
  301.   int sk_num(const STACK *st)
  302.   {
  303. > 	if(st == NULL) return -1;
  304.   	return st->num;
  305.   }

crypto/stack/stack.c:305:1: return from a call to sk_num
  303.   	if(st == NULL) return -1;
  304.   	return st->num;
  305. > }
  306.   
  307.   char *sk_value(const STACK *st, int i)

crypto/x509/x509_lu.c:294:30: Loop condition is true. Entering loop body
292.   	if (tmp == NULL)
293.   		{
294.   		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
                                    ^
295.   			{
296.   			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);

crypto/x509/x509_lu.c:296:4: 
294.   		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
295.   			{
296. > 			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);
297.   			j=X509_LOOKUP_by_subject(lu,type,name,&stmp);
298.   			if (j < 0)

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

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

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

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

crypto/x509/x509_lu.c:297:4: 
295.   			{
296.   			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);
297. > 			j=X509_LOOKUP_by_subject(lu,type,name,&stmp);
298.   			if (j < 0)
299.   				{

crypto/x509/x509_lu.c:122:1: start of procedure X509_LOOKUP_by_subject()
  120.   	}
  121.   
  122. > int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name,
  123.   	     X509_OBJECT *ret)
  124.   	{

crypto/x509/x509_lu.c:125:7: 
  123.   	     X509_OBJECT *ret)
  124.   	{
  125. > 	if ((ctx->method == NULL) || (ctx->method->get_by_subject == NULL))
  126.   		return X509_LU_FAIL;
  127.   	if (ctx->skip) return 0;
