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


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

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

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

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

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

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

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

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

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

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

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

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

apps/crl2p7.c:104:7: 
102.   
103.   	if (bio_err == NULL)
104. > 		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
105.   			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
106.   

crypto/bio/bss_file.c:130:1: start of procedure BIO_s_file()
  128.   	}
  129.   
  130. > BIO_METHOD *BIO_s_file(void)
  131.   	{
  132.   	return(&methods_filep);

crypto/bio/bss_file.c:132:2: 
  130.   BIO_METHOD *BIO_s_file(void)
  131.   	{
  132. > 	return(&methods_filep);
  133.   	}
  134.   

crypto/bio/bss_file.c:133:2: return from a call to BIO_s_file
  131.   	{
  132.   	return(&methods_filep);
  133.   	}
          ^
  134.   
  135.   static int MS_CALLBACK file_new(BIO *bi)

crypto/bio/bio_lib.c:66:1: start of procedure BIO_new()
  64.   #include <openssl/stack.h>
  65.   
  66. > BIO *BIO_new(BIO_METHOD *method)
  67.   	{
  68.   	BIO *ret=NULL;

crypto/bio/bio_lib.c:68:2: 
  66.   BIO *BIO_new(BIO_METHOD *method)
  67.   	{
  68. > 	BIO *ret=NULL;
  69.   
  70.   	ret=(BIO *)OPENSSL_malloc(sizeof(BIO));

crypto/bio/bio_lib.c:70:2: 
  68.   	BIO *ret=NULL;
  69.   
  70. > 	ret=(BIO *)OPENSSL_malloc(sizeof(BIO));
  71.   	if (ret == NULL)
  72.   		{

crypto/mem.c:289:1: start of procedure CRYPTO_malloc()
    287.   	}
    288.   
    289. > void *CRYPTO_malloc(int num, const char *file, int line)
    290.   	{
    291.   	void *ret = NULL;

crypto/mem.c:291:2: 
    289.   void *CRYPTO_malloc(int num, const char *file, int line)
    290.   	{
    291. > 	void *ret = NULL;
    292.   	extern unsigned char cleanse_ctr;
    293.   

crypto/mem.c:294:2: 
    292.   	extern unsigned char cleanse_ctr;
    293.   
    294. > 	allow_customize = 0;
    295.   	if (malloc_debug_func != NULL)
    296.   		{

crypto/mem.c:295:6: Taking true branch
    293.   
    294.   	allow_customize = 0;
    295.   	if (malloc_debug_func != NULL)
                ^
    296.   		{
    297.   		allow_customize_debug = 0;

crypto/mem.c:297:3: 
    295.   	if (malloc_debug_func != NULL)
    296.   		{
    297. > 		allow_customize_debug = 0;
    298.   		malloc_debug_func(NULL, num, file, line, 0);
    299.   		}

crypto/mem.c:298:3: Skipping __function_pointer__(): unresolved function pointer
    296.   		{
    297.   		allow_customize_debug = 0;
    298.   		malloc_debug_func(NULL, num, file, line, 0);
             ^
    299.   		}
    300.   	ret = malloc_ex_func(num,file,line);

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

crypto/mem.c:304:6: Taking true branch
    302.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
    303.   #endif
    304.   	if (malloc_debug_func != NULL)
                ^
    305.   		malloc_debug_func(ret, num, file, line, 1);
    306.   

crypto/mem.c:305:3: Skipping __function_pointer__(): unresolved function pointer
    303.   #endif
    304.   	if (malloc_debug_func != NULL)
    305.   		malloc_debug_func(ret, num, file, line, 1);
             ^
    306.   
    307.           /* Create a dependency on the value of 'cleanse_ctr' so our memory

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

crypto/mem.c:313:2: 
    311.                   ((unsigned char *)ret)[0] = cleanse_ctr;
    312.   
    313. > 	return ret;
    314.   	}
    315.   

crypto/mem.c:314:2: return from a call to CRYPTO_malloc
    312.   
    313.   	return ret;
    314.   	}
            ^
    315.   
    316.   void *CRYPTO_realloc(void *str, int num, const char *file, int line)

crypto/bio/bio_lib.c:71:6: Taking true branch
  69.   
  70.   	ret=(BIO *)OPENSSL_malloc(sizeof(BIO));
  71.   	if (ret == NULL)
             ^
  72.   		{
  73.   		BIOerr(BIO_F_BIO_NEW,ERR_R_MALLOC_FAILURE);

crypto/bio/bio_lib.c:73:3: 
  71.   	if (ret == NULL)
  72.   		{
  73. > 		BIOerr(BIO_F_BIO_NEW,ERR_R_MALLOC_FAILURE);
  74.   		return(NULL);
  75.   		}

crypto/err/err.c:617:1: start of procedure ERR_put_error()
    615.   /********************************************************/
    616.   
    617. > void ERR_put_error(int lib, int func, int reason, const char *file,
    618.   	     int line)
    619.   	{

crypto/err/err.c:641:2: Skipping ERR_get_state(): empty list of specs
    639.   	}
    640.   #endif
    641.   	es=ERR_get_state();
            ^
    642.   
    643.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:643:2: 
    641.   	es=ERR_get_state();
    642.   
    643. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    644.   	if (es->top == es->bottom)
    645.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:644:6: Taking false branch
    642.   
    643.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    644.   	if (es->top == es->bottom)
                ^
    645.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    646.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:646:2: 
    644.   	if (es->top == es->bottom)
    645.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    646. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    647.   	es->err_file[es->top]=file;
    648.   	es->err_line[es->top]=line;

crypto/err/err.c:647:2: 
    645.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    646.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    647. > 	es->err_file[es->top]=file;
    648.   	es->err_line[es->top]=line;
    649.   	err_clear_data(es,es->top);

crypto/err/err.c:648:2: 
    646.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    647.   	es->err_file[es->top]=file;
    648. > 	es->err_line[es->top]=line;
    649.   	err_clear_data(es,es->top);
    650.   	}

crypto/err/err.c:649:2: Taking true branch
    647.   	es->err_file[es->top]=file;
    648.   	es->err_line[es->top]=line;
    649.   	err_clear_data(es,es->top);
            ^
    650.   	}
    651.   

crypto/err/err.c:649:2: Taking false branch
    647.   	es->err_file[es->top]=file;
    648.   	es->err_line[es->top]=line;
    649.   	err_clear_data(es,es->top);
            ^
    650.   	}
    651.   

crypto/err/err.c:650:2: return from a call to ERR_put_error
    648.   	es->err_line[es->top]=line;
    649.   	err_clear_data(es,es->top);
    650.   	}
            ^
    651.   
    652.   void ERR_clear_error(void)

crypto/bio/bio_lib.c:74:3: 
  72.   		{
  73.   		BIOerr(BIO_F_BIO_NEW,ERR_R_MALLOC_FAILURE);
  74. > 		return(NULL);
  75.   		}
  76.   	if (!BIO_set(ret,method))

crypto/bio/bio_lib.c:82:2: return from a call to BIO_new
  80.   		}
  81.   	return(ret);
  82.   	}
         ^
  83.   
  84.   int BIO_set(BIO *bio, BIO_METHOD *method)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

crypto/mem.c:289:1: start of procedure CRYPTO_malloc()
      287.   	}
      288.   
      289. > void *CRYPTO_malloc(int num, const char *file, int line)
      290.   	{
      291.   	void *ret = NULL;

crypto/mem.c:291:2: 
      289.   void *CRYPTO_malloc(int num, const char *file, int line)
      290.   	{
      291. > 	void *ret = NULL;
      292.   	extern unsigned char cleanse_ctr;
      293.   

crypto/mem.c:294:2: 
      292.   	extern unsigned char cleanse_ctr;
      293.   
      294. > 	allow_customize = 0;
      295.   	if (malloc_debug_func != NULL)
      296.   		{

crypto/mem.c:295:6: Taking true branch
      293.   
      294.   	allow_customize = 0;
      295.   	if (malloc_debug_func != NULL)
                  ^
      296.   		{
      297.   		allow_customize_debug = 0;

crypto/mem.c:297:3: 
      295.   	if (malloc_debug_func != NULL)
      296.   		{
      297. > 		allow_customize_debug = 0;
      298.   		malloc_debug_func(NULL, num, file, line, 0);
      299.   		}

crypto/mem.c:298:3: Skipping __function_pointer__(): unresolved function pointer
      296.   		{
      297.   		allow_customize_debug = 0;
      298.   		malloc_debug_func(NULL, num, file, line, 0);
               ^
      299.   		}
      300.   	ret = malloc_ex_func(num,file,line);

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

crypto/mem.c:304:6: Taking true branch
      302.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
      303.   #endif
      304.   	if (malloc_debug_func != NULL)
                  ^
      305.   		malloc_debug_func(ret, num, file, line, 1);
      306.   

crypto/mem.c:305:3: Skipping __function_pointer__(): unresolved function pointer
      303.   #endif
      304.   	if (malloc_debug_func != NULL)
      305.   		malloc_debug_func(ret, num, file, line, 1);
               ^
      306.   
      307.           /* Create a dependency on the value of 'cleanse_ctr' so our memory

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

crypto/mem.c:313:2: 
      311.                   ((unsigned char *)ret)[0] = cleanse_ctr;
      312.   
      313. > 	return ret;
      314.   	}
      315.   

crypto/mem.c:314:2: return from a call to CRYPTO_malloc
      312.   
      313.   	return ret;
      314.   	}
              ^
      315.   
      316.   void *CRYPTO_realloc(void *str, int num, const char *file, int line)

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

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

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

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

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

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

apps/crl2p7.c:145:4: 
143.   			if (--argc < 1) goto bad;
144.   			if(!certflst) certflst = sk_new_null();
145. > 			sk_push(certflst,*(++argv));
146.   			}
147.   		else

crypto/stack/stack.c:251:1: start of procedure sk_push()
  249.   	}
  250.   
  251. > int sk_push(STACK *st, char *data)
  252.   	{
  253.   	return(sk_insert(st,data,st->num));

crypto/stack/stack.c:253:2: Skipping sk_insert(): empty list of specs
  251.   int sk_push(STACK *st, char *data)
  252.   	{
  253.   	return(sk_insert(st,data,st->num));
          ^
  254.   	}
  255.   
