apps/apps.c:2217: error: NULL_DEREFERENCE
  pointer `xptmp` last assigned on line 2216 could be null and is dereferenced by call to `X509_PURPOSE_get_id()` at line 2217, column 15.
Showing all 26 steps of the trace


apps/apps.c:2176:1: start of procedure args_verify()
2174.   }
2175.   
2176. > int args_verify(char ***pargs, int *pargc,
2177.   			int *badarg, BIO *err, X509_VERIFY_PARAM **pm)
2178.   	{

apps/apps.c:2179:2: 
2177.   			int *badarg, BIO *err, X509_VERIFY_PARAM **pm)
2178.   	{
2179. > 	ASN1_OBJECT *otmp = NULL;
2180.   	unsigned long flags = 0;
2181.   	int i;

apps/apps.c:2180:2: 
2178.   	{
2179.   	ASN1_OBJECT *otmp = NULL;
2180. > 	unsigned long flags = 0;
2181.   	int i;
2182.   	int purpose = 0;

apps/apps.c:2182:2: 
2180.   	unsigned long flags = 0;
2181.   	int i;
2182. > 	int purpose = 0;
2183.   	char **oldargs = *pargs;
2184.   	char *arg = **pargs, *argn = (*pargs)[1];

apps/apps.c:2183:2: 
2181.   	int i;
2182.   	int purpose = 0;
2183. > 	char **oldargs = *pargs;
2184.   	char *arg = **pargs, *argn = (*pargs)[1];
2185.   	if (!strcmp(arg, "-policy"))

apps/apps.c:2184:2: 
2182.   	int purpose = 0;
2183.   	char **oldargs = *pargs;
2184. > 	char *arg = **pargs, *argn = (*pargs)[1];
2185.   	if (!strcmp(arg, "-policy"))
2186.   		{

apps/apps.c:2185:7: Taking false branch
2183.   	char **oldargs = *pargs;
2184.   	char *arg = **pargs, *argn = (*pargs)[1];
2185.   	if (!strcmp(arg, "-policy"))
              ^
2186.   		{
2187.   		if (!argn)

apps/apps.c:2201:11: Taking true branch
2199.   		(*pargs)++;
2200.   		}
2201.   	else if (strcmp(arg,"-purpose") == 0)
                  ^
2202.   		{
2203.   		X509_PURPOSE *xptmp;

apps/apps.c:2204:8: Taking false branch
2202.   		{
2203.   		X509_PURPOSE *xptmp;
2204.   		if (!argn)
               ^
2205.   			*badarg = 1;
2206.   		else

apps/apps.c:2208:4: Skipping X509_PURPOSE_get_by_sname(): empty list of specs
2206.   		else
2207.   			{
2208.   			i = X509_PURPOSE_get_by_sname(argn);
           ^
2209.   			if(i < 0)
2210.   				{

apps/apps.c:2209:7: Taking false branch
2207.   			{
2208.   			i = X509_PURPOSE_get_by_sname(argn);
2209.   			if(i < 0)
              ^
2210.   				{
2211.   				BIO_printf(err, "unrecognized purpose\n");

apps/apps.c:2216:5: 
2214.   			else
2215.   				{
2216. > 				xptmp = X509_PURPOSE_get0(i);
2217.   				purpose = X509_PURPOSE_get_id(xptmp);
2218.   				}

crypto/x509v3/v3_purp.c:141:1: start of procedure X509_PURPOSE_get0()
  139.   }
  140.   
  141. > X509_PURPOSE * X509_PURPOSE_get0(int idx)
  142.   {
  143.   	if(idx < 0) return NULL;

crypto/x509v3/v3_purp.c:143:5: Taking false branch
  141.   X509_PURPOSE * X509_PURPOSE_get0(int idx)
  142.   {
  143.   	if(idx < 0) return NULL;
             ^
  144.   	if(idx < (int)X509_PURPOSE_COUNT) return xstandard + idx;
  145.   	return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);

crypto/x509v3/v3_purp.c:144:5: Taking false branch
  142.   {
  143.   	if(idx < 0) return NULL;
  144.   	if(idx < (int)X509_PURPOSE_COUNT) return xstandard + idx;
             ^
  145.   	return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);
  146.   }

crypto/x509v3/v3_purp.c:145:2: 
  143.   	if(idx < 0) return NULL;
  144.   	if(idx < (int)X509_PURPOSE_COUNT) return xstandard + idx;
  145. > 	return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);
  146.   }
  147.   

crypto/x509v3/x509v3.h:478:1: start of procedure sk_X509_PURPOSE_value()
    476.   #define X509V3_ADD_SILENT		0x10
    477.   
    478. > DECLARE_STACK_OF(X509_PURPOSE)
    479.   
    480.   DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS)

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 || (i < 0) || (i >= st->num)) return NULL;

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

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

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

crypto/x509v3/x509v3.h:478:1: return from a call to sk_X509_PURPOSE_value
    476.   #define X509V3_ADD_SILENT		0x10
    477.   
    478. > DECLARE_STACK_OF(X509_PURPOSE)
    479.   
    480.   DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS)

crypto/x509v3/v3_purp.c:146:1: return from a call to X509_PURPOSE_get0
  144.   	if(idx < (int)X509_PURPOSE_COUNT) return xstandard + idx;
  145.   	return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);
  146. > }
  147.   
  148.   int X509_PURPOSE_get_by_sname(char *sname)

apps/apps.c:2217:5: 
2215.   				{
2216.   				xptmp = X509_PURPOSE_get0(i);
2217. > 				purpose = X509_PURPOSE_get_id(xptmp);
2218.   				}
2219.   			}

crypto/x509v3/v3_purp.c:250:1: start of procedure X509_PURPOSE_get_id()
  248.   }
  249.   
  250. > int X509_PURPOSE_get_id(X509_PURPOSE *xp)
  251.   {
  252.   	return xp->purpose;

crypto/x509v3/v3_purp.c:252:2: 
  250.   int X509_PURPOSE_get_id(X509_PURPOSE *xp)
  251.   {
  252. > 	return xp->purpose;
  253.   }
  254.   
