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


apps/apps.c:2144:1: start of procedure args_verify()
2142.   #endif
2143.   
2144. > int args_verify(char ***pargs, int *pargc,
2145.   			int *badarg, BIO *err, X509_VERIFY_PARAM **pm)
2146.   	{

apps/apps.c:2147:2: 
2145.   			int *badarg, BIO *err, X509_VERIFY_PARAM **pm)
2146.   	{
2147. > 	ASN1_OBJECT *otmp = NULL;
2148.   	unsigned long flags = 0;
2149.   	int i;

apps/apps.c:2148:2: 
2146.   	{
2147.   	ASN1_OBJECT *otmp = NULL;
2148. > 	unsigned long flags = 0;
2149.   	int i;
2150.   	int purpose = 0;

apps/apps.c:2150:2: 
2148.   	unsigned long flags = 0;
2149.   	int i;
2150. > 	int purpose = 0;
2151.   	char **oldargs = *pargs;
2152.   	char *arg = **pargs, *argn = (*pargs)[1];

apps/apps.c:2151:2: 
2149.   	int i;
2150.   	int purpose = 0;
2151. > 	char **oldargs = *pargs;
2152.   	char *arg = **pargs, *argn = (*pargs)[1];
2153.   	if (!strcmp(arg, "-policy"))

apps/apps.c:2152:2: 
2150.   	int purpose = 0;
2151.   	char **oldargs = *pargs;
2152. > 	char *arg = **pargs, *argn = (*pargs)[1];
2153.   	if (!strcmp(arg, "-policy"))
2154.   		{

apps/apps.c:2153:7: Taking false branch
2151.   	char **oldargs = *pargs;
2152.   	char *arg = **pargs, *argn = (*pargs)[1];
2153.   	if (!strcmp(arg, "-policy"))
              ^
2154.   		{
2155.   		if (!argn)

apps/apps.c:2169:11: Taking true branch
2167.   		(*pargs)++;
2168.   		}
2169.   	else if (strcmp(arg,"-purpose") == 0)
                  ^
2170.   		{
2171.   		X509_PURPOSE *xptmp;

apps/apps.c:2172:8: Taking false branch
2170.   		{
2171.   		X509_PURPOSE *xptmp;
2172.   		if (!argn)
               ^
2173.   			*badarg = 1;
2174.   		else

apps/apps.c:2176:4: Skipping X509_PURPOSE_get_by_sname(): empty list of specs
2174.   		else
2175.   			{
2176.   			i = X509_PURPOSE_get_by_sname(argn);
           ^
2177.   			if(i < 0)
2178.   				{

apps/apps.c:2177:7: Taking false branch
2175.   			{
2176.   			i = X509_PURPOSE_get_by_sname(argn);
2177.   			if(i < 0)
              ^
2178.   				{
2179.   				BIO_printf(err, "unrecognized purpose\n");

apps/apps.c:2184:5: 
2182.   			else
2183.   				{
2184. > 				xptmp = X509_PURPOSE_get0(i);
2185.   				purpose = X509_PURPOSE_get_id(xptmp);
2186.   				}

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

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

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

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

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

apps/apps.c:2185:5: 
2183.   				{
2184.   				xptmp = X509_PURPOSE_get0(i);
2185. > 				purpose = X509_PURPOSE_get_id(xptmp);
2186.   				}
2187.   			}

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

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