apps/crl2p7.c:144: error: NULL_DEREFERENCE
  pointer `certflst` last assigned on line 143 could be null and is dereferenced by call to `sk_push()` at line 144, column 4.
Showing all 53 steps of the trace


apps/crl2p7.c:86:1: start of procedure crl2pkcs7_main()
84.   int MAIN(int, char **);
85.   
86. > int MAIN(int argc, char **argv)
87.   	{
88.   	int i,badops=0;

apps/crl2p7.c:88:2: 
86.   int MAIN(int argc, char **argv)
87.   	{
88. > 	int i,badops=0;
89.   	BIO *in=NULL,*out=NULL;
90.   	int informat,outformat;

apps/crl2p7.c:89:2: 
87.   	{
88.   	int i,badops=0;
89. > 	BIO *in=NULL,*out=NULL;
90.   	int informat,outformat;
91.   	char *infile,*outfile,*prog,*certfile;

apps/crl2p7.c:92:2: 
90.   	int informat,outformat;
91.   	char *infile,*outfile,*prog,*certfile;
92. > 	PKCS7 *p7 = NULL;
93.   	PKCS7_SIGNED *p7s = NULL;
94.   	X509_CRL *crl=NULL;

apps/crl2p7.c:93:2: 
91.   	char *infile,*outfile,*prog,*certfile;
92.   	PKCS7 *p7 = NULL;
93. > 	PKCS7_SIGNED *p7s = NULL;
94.   	X509_CRL *crl=NULL;
95.   	STACK_OF(OPENSSL_STRING) *certflst=NULL;

apps/crl2p7.c:94:2: 
92.   	PKCS7 *p7 = NULL;
93.   	PKCS7_SIGNED *p7s = NULL;
94. > 	X509_CRL *crl=NULL;
95.   	STACK_OF(OPENSSL_STRING) *certflst=NULL;
96.   	STACK_OF(X509_CRL) *crl_stack=NULL;

apps/crl2p7.c:95:2: 
93.   	PKCS7_SIGNED *p7s = NULL;
94.   	X509_CRL *crl=NULL;
95. > 	STACK_OF(OPENSSL_STRING) *certflst=NULL;
96.   	STACK_OF(X509_CRL) *crl_stack=NULL;
97.   	STACK_OF(X509) *cert_stack=NULL;

apps/crl2p7.c:96:2: 
94.   	X509_CRL *crl=NULL;
95.   	STACK_OF(OPENSSL_STRING) *certflst=NULL;
96. > 	STACK_OF(X509_CRL) *crl_stack=NULL;
97.   	STACK_OF(X509) *cert_stack=NULL;
98.   	int ret=1,nocrl=0;

apps/crl2p7.c:97:2: 
95.   	STACK_OF(OPENSSL_STRING) *certflst=NULL;
96.   	STACK_OF(X509_CRL) *crl_stack=NULL;
97. > 	STACK_OF(X509) *cert_stack=NULL;
98.   	int ret=1,nocrl=0;
99.   

apps/crl2p7.c:98:2: 
96.   	STACK_OF(X509_CRL) *crl_stack=NULL;
97.   	STACK_OF(X509) *cert_stack=NULL;
98. > 	int ret=1,nocrl=0;
99.   
100.   	apps_startup();

apps/crl2p7.c:100:2: 
98.   	int ret=1,nocrl=0;
99.   
100. > 	apps_startup();
101.   
102.   	if (bio_err == NULL)

apps/crl2p7.c:102:6: Taking false branch
100.   	apps_startup();
101.   
102.   	if (bio_err == NULL)
            ^
103.   		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
104.   			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);

apps/crl2p7.c:106:2: 
104.   			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
105.   
106. > 	infile=NULL;
107.   	outfile=NULL;
108.   	informat=FORMAT_PEM;

apps/crl2p7.c:107:2: 
105.   
106.   	infile=NULL;
107. > 	outfile=NULL;
108.   	informat=FORMAT_PEM;
109.   	outformat=FORMAT_PEM;

apps/crl2p7.c:108:2: 
106.   	infile=NULL;
107.   	outfile=NULL;
108. > 	informat=FORMAT_PEM;
109.   	outformat=FORMAT_PEM;
110.   

apps/crl2p7.c:109:2: 
107.   	outfile=NULL;
108.   	informat=FORMAT_PEM;
109. > 	outformat=FORMAT_PEM;
110.   
111.   	prog=argv[0];

apps/crl2p7.c:111:2: 
109.   	outformat=FORMAT_PEM;
110.   
111. > 	prog=argv[0];
112.   	argc--;
113.   	argv++;

apps/crl2p7.c:112:2: 
110.   
111.   	prog=argv[0];
112. > 	argc--;
113.   	argv++;
114.   	while (argc >= 1)

apps/crl2p7.c:113:2: 
111.   	prog=argv[0];
112.   	argc--;
113. > 	argv++;
114.   	while (argc >= 1)
115.   		{

apps/crl2p7.c:114:9: Loop condition is true. Entering loop body
112.   	argc--;
113.   	argv++;
114.   	while (argc >= 1)
               ^
115.   		{
116.   		if 	(strcmp(*argv,"-inform") == 0)

apps/crl2p7.c:116:8: Taking false branch
114.   	while (argc >= 1)
115.   		{
116.   		if 	(strcmp(*argv,"-inform") == 0)
              ^
117.   			{
118.   			if (--argc < 1) goto bad;

apps/crl2p7.c:121:12: Taking false branch
119.   			informat=str2fmt(*(++argv));
120.   			}
121.   		else if (strcmp(*argv,"-outform") == 0)
                  ^
122.   			{
123.   			if (--argc < 1) goto bad;

apps/crl2p7.c:126:12: Taking false branch
124.   			outformat=str2fmt(*(++argv));
125.   			}
126.   		else if (strcmp(*argv,"-in") == 0)
                  ^
127.   			{
128.   			if (--argc < 1) goto bad;

apps/crl2p7.c:131:12: Taking false branch
129.   			infile= *(++argv);
130.   			}
131.   		else if (strcmp(*argv,"-nocrl") == 0)
                  ^
132.   			{
133.   			nocrl=1;

apps/crl2p7.c:135:12: Taking false branch
133.   			nocrl=1;
134.   			}
135.   		else if (strcmp(*argv,"-out") == 0)
                  ^
136.   			{
137.   			if (--argc < 1) goto bad;

apps/crl2p7.c:140:12: Taking true branch
138.   			outfile= *(++argv);
139.   			}
140.   		else if (strcmp(*argv,"-certfile") == 0)
                  ^
141.   			{
142.   			if (--argc < 1) goto bad;

apps/crl2p7.c:142:8: Taking false branch
140.   		else if (strcmp(*argv,"-certfile") == 0)
141.   			{
142.   			if (--argc < 1) goto bad;
              ^
143.   			if(!certflst) certflst = sk_OPENSSL_STRING_new_null();
144.   			sk_OPENSSL_STRING_push(certflst,*(++argv));

apps/crl2p7.c:143:8: Taking true branch
141.   			{
142.   			if (--argc < 1) goto bad;
143.   			if(!certflst) certflst = sk_OPENSSL_STRING_new_null();
              ^
144.   			sk_OPENSSL_STRING_push(certflst,*(++argv));
145.   			}

apps/crl2p7.c:143:18: 
141.   			{
142.   			if (--argc < 1) goto bad;
143. > 			if(!certflst) certflst = sk_OPENSSL_STRING_new_null();
144.   			sk_OPENSSL_STRING_push(certflst,*(++argv));
145.   			}

crypto/stack/stack.c:115:1: start of procedure sk_new_null()
  113.   	}
  114.   
  115. > _STACK *sk_new_null(void)
  116.   	{
  117.   	return sk_new((int (*)(const void *, const void *))0);

crypto/stack/stack.c:117:2: 
  115.   _STACK *sk_new_null(void)
  116.   	{
  117. > 	return sk_new((int (*)(const void *, const void *))0);
  118.   	}
  119.   

crypto/stack/stack.c:120:1: start of procedure sk_new()
    118.   	}
    119.   
    120. > _STACK *sk_new(int (*c)(const void *, const void *))
    121.   	{
    122.   	_STACK *ret;

crypto/stack/stack.c:125:6: 
    123.   	int i;
    124.   
    125. > 	if ((ret=OPENSSL_malloc(sizeof(_STACK))) == NULL)
    126.   		goto err;
    127.   	if ((ret->data=OPENSSL_malloc(sizeof(char *)*MIN_NODES)) == NULL)

crypto/mem.c:294:1: start of procedure CRYPTO_malloc()
      292.   	}
      293.   
      294. > void *CRYPTO_malloc(int num, const char *file, int line)
      295.   	{
      296.   	void *ret = NULL;

crypto/mem.c:296:2: 
      294.   void *CRYPTO_malloc(int num, const char *file, int line)
      295.   	{
      296. > 	void *ret = NULL;
      297.   
      298.   	if (num <= 0) return NULL;

crypto/mem.c:298:6: Taking false branch
      296.   	void *ret = NULL;
      297.   
      298.   	if (num <= 0) return NULL;
                  ^
      299.   
      300.   	allow_customize = 0;

crypto/mem.c:300:2: 
      298.   	if (num <= 0) return NULL;
      299.   
      300. > 	allow_customize = 0;
      301.   	if (malloc_debug_func != NULL)
      302.   		{

crypto/mem.c:301:6: Taking false branch
      299.   
      300.   	allow_customize = 0;
      301.   	if (malloc_debug_func != NULL)
                  ^
      302.   		{
      303.   		allow_customize_debug = 0;

crypto/mem.c:306:2: Skipping __function_pointer__(): unresolved function pointer
      304.   		malloc_debug_func(NULL, num, file, line, 0);
      305.   		}
      306.   	ret = malloc_ex_func(num,file,line);
              ^
      307.   #ifdef LEVITTE_DEBUG_MEM
      308.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);

crypto/mem.c:310:6: Taking false branch
      308.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
      309.   #endif
      310.   	if (malloc_debug_func != NULL)
                  ^
      311.   		malloc_debug_func(ret, num, file, line, 1);
      312.   

crypto/mem.c:317:12: Taking false branch
      315.            * sanitisation function can't be optimised out. NB: We only do
      316.            * this for >2Kb so the overhead doesn't bother us. */
      317.           if(ret && (num > 2048))
                        ^
      318.   	{	extern unsigned char cleanse_ctr;
      319.                   ((unsigned char *)ret)[0] = cleanse_ctr;

crypto/mem.c:323:2: 
      321.   #endif
      322.   
      323. > 	return ret;
      324.   	}
      325.   char *CRYPTO_strdup(const char *str, const char *file, int line)

crypto/mem.c:324:2: return from a call to CRYPTO_malloc
      322.   
      323.   	return ret;
      324.   	}
              ^
      325.   char *CRYPTO_strdup(const char *str, const char *file, int line)
      326.   	{

crypto/stack/stack.c:125:6: Taking true branch
    123.   	int i;
    124.   
    125.   	if ((ret=OPENSSL_malloc(sizeof(_STACK))) == NULL)
                ^
    126.   		goto err;
    127.   	if ((ret->data=OPENSSL_malloc(sizeof(char *)*MIN_NODES)) == NULL)

crypto/stack/stack.c:136:1: 
    134.   	ret->sorted=0;
    135.   	return(ret);
    136. > err:
    137.   	if(ret)
    138.   		OPENSSL_free(ret);

crypto/stack/stack.c:137:5: Taking false branch
    135.   	return(ret);
    136.   err:
    137.   	if(ret)
               ^
    138.   		OPENSSL_free(ret);
    139.   	return(NULL);

crypto/stack/stack.c:139:2: 
    137.   	if(ret)
    138.   		OPENSSL_free(ret);
    139. > 	return(NULL);
    140.   	}
    141.   

crypto/stack/stack.c:140:2: return from a call to sk_new
    138.   		OPENSSL_free(ret);
    139.   	return(NULL);
    140.   	}
            ^
    141.   
    142.   int sk_insert(_STACK *st, void *data, int loc)

crypto/stack/stack.c:118:2: return from a call to sk_new_null
  116.   	{
  117.   	return sk_new((int (*)(const void *, const void *))0);
  118.   	}
          ^
  119.   
  120.   _STACK *sk_new(int (*c)(const void *, const void *))

apps/crl2p7.c:144:4: Condition is true
142.   			if (--argc < 1) goto bad;
143.   			if(!certflst) certflst = sk_OPENSSL_STRING_new_null();
144.   			sk_OPENSSL_STRING_push(certflst,*(++argv));
          ^
145.   			}
146.   		else

apps/crl2p7.c:144:4: Condition is true
142.   			if (--argc < 1) goto bad;
143.   			if(!certflst) certflst = sk_OPENSSL_STRING_new_null();
144.   			sk_OPENSSL_STRING_push(certflst,*(++argv));
          ^
145.   			}
146.   		else

crypto/stack/stack.c:244:1: start of procedure sk_push()
  242.   	}
  243.   
  244. > int sk_push(_STACK *st, void *data)
  245.   	{
  246.   	return(sk_insert(st,data,st->num));

crypto/stack/stack.c:246:2: Skipping sk_insert(): empty list of specs
  244.   int sk_push(_STACK *st, void *data)
  245.   	{
  246.   	return(sk_insert(st,data,st->num));
          ^
  247.   	}
  248.   
