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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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 false 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:13: Taking false 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:24: 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/v3_purp.c:144:1: return from a call to X509_PURPOSE_get0
  142.   	if(idx < (int)X509_PURPOSE_COUNT) return xstandard + idx;
  143.   	return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);
  144. > }
  145.   
  146.   int X509_PURPOSE_get_by_sname(char *sname)

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

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

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