crypto/x509/x509_vfy.c:245: error: NULL_DEREFERENCE
  pointer `x` last assigned on line 244 could be null and is dereferenced by call to `X509_get_subject_name()` at line 245, column 7.
Showing all 48 steps of the trace


crypto/x509/x509_vfy.c:153:1: start of procedure X509_verify_cert()
151.   #endif
152.   
153. > int X509_verify_cert(X509_STORE_CTX *ctx)
154.   	{
155.   	X509 *x,*xtmp,*chain_ss=NULL;

crypto/x509/x509_vfy.c:155:2: 
153.   int X509_verify_cert(X509_STORE_CTX *ctx)
154.   	{
155. > 	X509 *x,*xtmp,*chain_ss=NULL;
156.   	X509_NAME *xn;
157.   	int bad_chain = 0;

crypto/x509/x509_vfy.c:157:2: 
155.   	X509 *x,*xtmp,*chain_ss=NULL;
156.   	X509_NAME *xn;
157. > 	int bad_chain = 0;
158.   	X509_VERIFY_PARAM *param = ctx->param;
159.   	int depth,i,ok=0;

crypto/x509/x509_vfy.c:158:2: 
156.   	X509_NAME *xn;
157.   	int bad_chain = 0;
158. > 	X509_VERIFY_PARAM *param = ctx->param;
159.   	int depth,i,ok=0;
160.   	int num;

crypto/x509/x509_vfy.c:159:2: 
157.   	int bad_chain = 0;
158.   	X509_VERIFY_PARAM *param = ctx->param;
159. > 	int depth,i,ok=0;
160.   	int num;
161.   	int (*cb)(int xok,X509_STORE_CTX *xctx);

crypto/x509/x509_vfy.c:162:2: 
160.   	int num;
161.   	int (*cb)(int xok,X509_STORE_CTX *xctx);
162. > 	STACK_OF(X509) *sktmp=NULL;
163.   	if (ctx->cert == NULL)
164.   		{

crypto/x509/x509_vfy.c:163:6: Taking false branch
161.   	int (*cb)(int xok,X509_STORE_CTX *xctx);
162.   	STACK_OF(X509) *sktmp=NULL;
163.   	if (ctx->cert == NULL)
            ^
164.   		{
165.   		X509err(X509_F_X509_VERIFY_CERT,X509_R_NO_CERT_SET_FOR_US_TO_VERIFY);

crypto/x509/x509_vfy.c:169:2: 
167.   		}
168.   
169. > 	cb=ctx->verify_cb;
170.   
171.   	/* first we make sure the chain we are going to build is

crypto/x509/x509_vfy.c:173:6: Taking false branch
171.   	/* first we make sure the chain we are going to build is
172.   	 * present and that the first entry is in place */
173.   	if (ctx->chain == NULL)
            ^
174.   		{
175.   		if (	((ctx->chain=sk_X509_new_null()) == NULL) ||

crypto/x509/x509_vfy.c:186:6: Taking false branch
184.   
185.   	/* We use a temporary STACK so we can chop and hack at it */
186.   	if (ctx->untrusted != NULL
            ^
187.   	    && (sktmp=sk_X509_dup(ctx->untrusted)) == NULL)
188.   		{

crypto/x509/x509_vfy.c:193:6: Condition is true
191.   		}
192.   
193.   	num=sk_X509_num(ctx->chain);
            ^
194.   	x=sk_X509_value(ctx->chain,num-1);
195.   	depth=param->depth;

crypto/x509/x509_vfy.c:193:2: 
191.   		}
192.   
193. > 	num=sk_X509_num(ctx->chain);
194.   	x=sk_X509_value(ctx->chain,num-1);
195.   	depth=param->depth;

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

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

crypto/stack/stack.c:305:2: 
  303.   {
  304.   	if(st == NULL) return -1;
  305. > 	return st->num;
  306.   }
  307.   

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

crypto/x509/x509_vfy.c:194:4: Condition is true
192.   
193.   	num=sk_X509_num(ctx->chain);
194.   	x=sk_X509_value(ctx->chain,num-1);
          ^
195.   	depth=param->depth;
196.   

crypto/x509/x509_vfy.c:194:2: 
192.   
193.   	num=sk_X509_num(ctx->chain);
194. > 	x=sk_X509_value(ctx->chain,num-1);
195.   	depth=param->depth;
196.   

crypto/stack/stack.c:308:1: start of procedure sk_value()
  306.   }
  307.   
  308. > void *sk_value(const _STACK *st, int i)
  309.   {
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;

crypto/stack/stack.c:310:6: Taking false branch
  308.   void *sk_value(const _STACK *st, int i)
  309.   {
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
              ^
  311.   	return st->data[i];
  312.   }

crypto/stack/stack.c:310:13: Taking false branch
  308.   void *sk_value(const _STACK *st, int i)
  309.   {
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                     ^
  311.   	return st->data[i];
  312.   }

crypto/stack/stack.c:310:24: Taking false branch
  308.   void *sk_value(const _STACK *st, int i)
  309.   {
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                                ^
  311.   	return st->data[i];
  312.   }

crypto/stack/stack.c:311:2: 
  309.   {
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
  311. > 	return st->data[i];
  312.   }
  313.   

crypto/stack/stack.c:312:1: return from a call to sk_value
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
  311.   	return st->data[i];
  312. > }
  313.   
  314.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x509_vfy.c:195:2: 
193.   	num=sk_X509_num(ctx->chain);
194.   	x=sk_X509_value(ctx->chain,num-1);
195. > 	depth=param->depth;
196.   
197.   

crypto/x509/x509_vfy.c:233:3: Loop condition is true. Entering loop body
231.   			}
232.   		break;
233.   		}
         ^
234.   
235.   	/* at this point, chain should contain a list of untrusted

crypto/x509/x509_vfy.c:201:7: Taking false branch
199.   		{
200.   		/* If we have enough, we break */
201.   		if (depth < num) break; /* FIXME: If this happens, we should take
             ^
202.   		                         * note of it and, if appropriate, use the
203.   		                         * X509_V_ERR_CERT_CHAIN_TOO_LONG error

crypto/x509/x509_vfy.c:208:3: 
206.   
207.   		/* If we are self signed, we break */
208. > 		xn=X509_get_issuer_name(x);
209.   		if (ctx->check_issued(ctx, x,x)) break;
210.   

crypto/x509/x509_cmp.c:126:1: start of procedure X509_get_issuer_name()
  124.   #endif
  125.   
  126. > X509_NAME *X509_get_issuer_name(X509 *a)
  127.   	{
  128.   	return(a->cert_info->issuer);

crypto/x509/x509_cmp.c:128:2: 
  126.   X509_NAME *X509_get_issuer_name(X509 *a)
  127.   	{
  128. > 	return(a->cert_info->issuer);
  129.   	}
  130.   

crypto/x509/x509_cmp.c:129:2: return from a call to X509_get_issuer_name
  127.   	{
  128.   	return(a->cert_info->issuer);
  129.   	}
          ^
  130.   
  131.   unsigned long X509_issuer_name_hash(X509 *x)

crypto/x509/x509_vfy.c:209:7: Taking true branch
207.   		/* If we are self signed, we break */
208.   		xn=X509_get_issuer_name(x);
209.   		if (ctx->check_issued(ctx, x,x)) break;
             ^
210.   
211.   		/* If we were passed a cert chain, use it first */

crypto/x509/x509_vfy.c:243:4: Condition is true
241.    	 */
242.   
243.   	i=sk_X509_num(ctx->chain);
          ^
244.   	x=sk_X509_value(ctx->chain,i-1);
245.   	xn = X509_get_subject_name(x);

crypto/x509/x509_vfy.c:243:2: 
241.    	 */
242.   
243. > 	i=sk_X509_num(ctx->chain);
244.   	x=sk_X509_value(ctx->chain,i-1);
245.   	xn = X509_get_subject_name(x);

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

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

crypto/stack/stack.c:305:2: 
  303.   {
  304.   	if(st == NULL) return -1;
  305. > 	return st->num;
  306.   }
  307.   

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

crypto/x509/x509_vfy.c:244:4: Condition is true
242.   
243.   	i=sk_X509_num(ctx->chain);
244.   	x=sk_X509_value(ctx->chain,i-1);
          ^
245.   	xn = X509_get_subject_name(x);
246.   	if (ctx->check_issued(ctx, x, x))

crypto/x509/x509_vfy.c:244:2: 
242.   
243.   	i=sk_X509_num(ctx->chain);
244. > 	x=sk_X509_value(ctx->chain,i-1);
245.   	xn = X509_get_subject_name(x);
246.   	if (ctx->check_issued(ctx, x, x))

crypto/stack/stack.c:308:1: start of procedure sk_value()
  306.   }
  307.   
  308. > void *sk_value(const _STACK *st, int i)
  309.   {
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;

crypto/stack/stack.c:310:6: Taking false branch
  308.   void *sk_value(const _STACK *st, int i)
  309.   {
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
              ^
  311.   	return st->data[i];
  312.   }

crypto/stack/stack.c:310:13: Taking true branch
  308.   void *sk_value(const _STACK *st, int i)
  309.   {
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                     ^
  311.   	return st->data[i];
  312.   }

crypto/stack/stack.c:310:39: 
  308.   void *sk_value(const _STACK *st, int i)
  309.   {
  310. > 	if(!st || (i < 0) || (i >= st->num)) return NULL;
  311.   	return st->data[i];
  312.   }

crypto/stack/stack.c:312:1: return from a call to sk_value
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
  311.   	return st->data[i];
  312. > }
  313.   
  314.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x509_vfy.c:245:2: 
243.   	i=sk_X509_num(ctx->chain);
244.   	x=sk_X509_value(ctx->chain,i-1);
245. > 	xn = X509_get_subject_name(x);
246.   	if (ctx->check_issued(ctx, x, x))
247.   		{

crypto/x509/x509_cmp.c:136:1: start of procedure X509_get_subject_name()
  134.   	}
  135.   
  136. > X509_NAME *X509_get_subject_name(X509 *a)
  137.   	{
  138.   	return(a->cert_info->subject);

crypto/x509/x509_cmp.c:138:2: 
  136.   X509_NAME *X509_get_subject_name(X509 *a)
  137.   	{
  138. > 	return(a->cert_info->subject);
  139.   	}
  140.   
