crypto/rsa/rsa_sign.c:224: error: NULL_DEREFERENCE
  pointer `s` last assigned on line 163 could be null and is dereferenced by call to `memset()` at line 224, column 2.
Showing all 54 steps of the trace


crypto/rsa/rsa_sign.c:145:1: start of procedure RSA_verify()
143.   	}
144.   
145. > int RSA_verify(int dtype, const unsigned char *m, unsigned int m_len,
146.   	     unsigned char *sigbuf, unsigned int siglen, RSA *rsa)
147.   	{

crypto/rsa/rsa_sign.c:148:2: 
146.   	     unsigned char *sigbuf, unsigned int siglen, RSA *rsa)
147.   	{
148. > 	int i,ret=0,sigtype;
149.   	unsigned char *p,*s;
150.   	X509_SIG *sig=NULL;

crypto/rsa/rsa_sign.c:150:2: 
148.   	int i,ret=0,sigtype;
149.   	unsigned char *p,*s;
150. > 	X509_SIG *sig=NULL;
151.   
152.   	if (siglen != (unsigned int)RSA_size(rsa))

crypto/rsa/rsa_sign.c:152:6: 
150.   	X509_SIG *sig=NULL;
151.   
152. > 	if (siglen != (unsigned int)RSA_size(rsa))
153.   		{
154.   		RSAerr(RSA_F_RSA_VERIFY,RSA_R_WRONG_SIGNATURE_LENGTH);

crypto/rsa/rsa_lib.c:248:1: start of procedure RSA_size()
  246.   	}
  247.   
  248. > int RSA_size(const RSA *r)
  249.   	{
  250.   	return(BN_num_bytes(r->n));

crypto/rsa/rsa_lib.c:250:2: 
  248.   int RSA_size(const RSA *r)
  249.   	{
  250. > 	return(BN_num_bytes(r->n));
  251.   	}
  252.   

crypto/bn/bn_lib.c:245:1: start of procedure BN_num_bits()
    243.   	}
    244.   
    245. > int BN_num_bits(const BIGNUM *a)
    246.   	{
    247.   	BN_ULONG l;

crypto/bn/bn_lib.c:252:6: Taking false branch
    250.   	bn_check_top(a);
    251.   
    252.   	if (a->top == 0) return(0);
                ^
    253.   	l=a->d[a->top-1];
    254.   	assert(l != 0);

crypto/bn/bn_lib.c:253:2: 
    251.   
    252.   	if (a->top == 0) return(0);
    253. > 	l=a->d[a->top-1];
    254.   	assert(l != 0);
    255.   	i=(a->top-1)*BN_BITS2;

crypto/bn/bn_lib.c:254:2: 
    252.   	if (a->top == 0) return(0);
    253.   	l=a->d[a->top-1];
    254. > 	assert(l != 0);
    255.   	i=(a->top-1)*BN_BITS2;
    256.   	return(i+BN_num_bits_word(l));

crypto/bn/bn_lib.c:255:2: 
    253.   	l=a->d[a->top-1];
    254.   	assert(l != 0);
    255. > 	i=(a->top-1)*BN_BITS2;
    256.   	return(i+BN_num_bits_word(l));
    257.   	}

crypto/bn/bn_lib.c:256:2: Skipping BN_num_bits_word(): empty list of specs
    254.   	assert(l != 0);
    255.   	i=(a->top-1)*BN_BITS2;
    256.   	return(i+BN_num_bits_word(l));
            ^
    257.   	}
    258.   

crypto/bn/bn_lib.c:257:2: return from a call to BN_num_bits
    255.   	i=(a->top-1)*BN_BITS2;
    256.   	return(i+BN_num_bits_word(l));
    257.   	}
            ^
    258.   
    259.   void BN_clear_free(BIGNUM *a)

crypto/rsa/rsa_lib.c:251:2: return from a call to RSA_size
  249.   	{
  250.   	return(BN_num_bytes(r->n));
  251.   	}
          ^
  252.   
  253.   int RSA_public_encrypt(int flen, const unsigned char *from, unsigned char *to,

crypto/rsa/rsa_sign.c:152:6: Taking false branch
150.   	X509_SIG *sig=NULL;
151.   
152.   	if (siglen != (unsigned int)RSA_size(rsa))
            ^
153.   		{
154.   		RSAerr(RSA_F_RSA_VERIFY,RSA_R_WRONG_SIGNATURE_LENGTH);

crypto/rsa/rsa_sign.c:158:6: Taking true branch
156.   		}
157.   
158.   	if((rsa->flags & RSA_FLAG_SIGN_VER)
            ^
159.   	    && ENGINE_get_RSA(rsa->engine)->rsa_verify)
160.   	    return ENGINE_get_RSA(rsa->engine)->rsa_verify(dtype,

crypto/rsa/rsa_sign.c:159:9: 
157.   
158.   	if((rsa->flags & RSA_FLAG_SIGN_VER)
159. > 	    && ENGINE_get_RSA(rsa->engine)->rsa_verify)
160.   	    return ENGINE_get_RSA(rsa->engine)->rsa_verify(dtype,
161.   			m, m_len, sigbuf, siglen, rsa);

crypto/engine/tb_rsa.c:110:1: start of procedure ENGINE_get_RSA()
  108.   
  109.   /* Obtains an RSA implementation from an ENGINE functional reference */
  110. > const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e)
  111.   	{
  112.   	return e->rsa_meth;

crypto/engine/tb_rsa.c:112:2: 
  110.   const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e)
  111.   	{
  112. > 	return e->rsa_meth;
  113.   	}
  114.   

crypto/engine/tb_rsa.c:113:2: return from a call to ENGINE_get_RSA
  111.   	{
  112.   	return e->rsa_meth;
  113.   	}
          ^
  114.   
  115.   /* Sets an RSA implementation in an ENGINE structure */

crypto/rsa/rsa_sign.c:159:9: Taking false branch
157.   
158.   	if((rsa->flags & RSA_FLAG_SIGN_VER)
159.   	    && ENGINE_get_RSA(rsa->engine)->rsa_verify)
               ^
160.   	    return ENGINE_get_RSA(rsa->engine)->rsa_verify(dtype,
161.   			m, m_len, sigbuf, siglen, rsa);

crypto/rsa/rsa_sign.c:163:2: 
161.   			m, m_len, sigbuf, siglen, rsa);
162.   
163. > 	s=(unsigned char *)OPENSSL_malloc((unsigned int)siglen);
164.   	if (s == NULL)
165.   		{

crypto/mem.c:282:1: start of procedure CRYPTO_malloc()
  280.   	}
  281.   
  282. > void *CRYPTO_malloc(int num, const char *file, int line)
  283.   	{
  284.   	void *ret = NULL;

crypto/mem.c:284:2: 
  282.   void *CRYPTO_malloc(int num, const char *file, int line)
  283.   	{
  284. > 	void *ret = NULL;
  285.   
  286.   	allow_customize = 0;

crypto/mem.c:286:2: 
  284.   	void *ret = NULL;
  285.   
  286. > 	allow_customize = 0;
  287.   	if (malloc_debug_func != NULL)
  288.   		{

crypto/mem.c:287:6: Taking false branch
  285.   
  286.   	allow_customize = 0;
  287.   	if (malloc_debug_func != NULL)
              ^
  288.   		{
  289.   		allow_customize_debug = 0;

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

crypto/mem.c:296:6: Taking false branch
  294.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
  295.   #endif
  296.   	if (malloc_debug_func != NULL)
              ^
  297.   		malloc_debug_func(ret, num, file, line, 1);
  298.   

crypto/mem.c:299:2: 
  297.   		malloc_debug_func(ret, num, file, line, 1);
  298.   
  299. > 	return ret;
  300.   	}
  301.   

crypto/mem.c:300:2: return from a call to CRYPTO_malloc
  298.   
  299.   	return ret;
  300.   	}
          ^
  301.   
  302.   void *CRYPTO_realloc(void *str, int num, const char *file, int line)

crypto/rsa/rsa_sign.c:164:6: Taking true branch
162.   
163.   	s=(unsigned char *)OPENSSL_malloc((unsigned int)siglen);
164.   	if (s == NULL)
            ^
165.   		{
166.   		RSAerr(RSA_F_RSA_VERIFY,ERR_R_MALLOC_FAILURE);

crypto/rsa/rsa_sign.c:166:3: 
164.   	if (s == NULL)
165.   		{
166. > 		RSAerr(RSA_F_RSA_VERIFY,ERR_R_MALLOC_FAILURE);
167.   		goto err;
168.   		}

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

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

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

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

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

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

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

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

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

crypto/mem.c:318:1: start of procedure CRYPTO_free()
    316.   	}
    317.   
    318. > void CRYPTO_free(void *str)
    319.   	{
    320.   	if (free_debug_func != NULL)

crypto/mem.c:320:6: Taking true branch
    318.   void CRYPTO_free(void *str)
    319.   	{
    320.   	if (free_debug_func != NULL)
                ^
    321.   		free_debug_func(str, 0);
    322.   #ifdef LEVITTE_DEBUG_MEM

crypto/mem.c:321:3: Skipping __function_pointer__(): unresolved function pointer
    319.   	{
    320.   	if (free_debug_func != NULL)
    321.   		free_debug_func(str, 0);
             ^
    322.   #ifdef LEVITTE_DEBUG_MEM
    323.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         < 0x%p\n", str);

crypto/mem.c:325:2: Skipping __function_pointer__(): unresolved function pointer
    323.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         < 0x%p\n", str);
    324.   #endif
    325.   	free_func(str);
            ^
    326.   	if (free_debug_func != NULL)
    327.   		free_debug_func(NULL, 1);

crypto/mem.c:326:6: Taking true branch
    324.   #endif
    325.   	free_func(str);
    326.   	if (free_debug_func != NULL)
                ^
    327.   		free_debug_func(NULL, 1);
    328.   	}

crypto/mem.c:327:3: Skipping __function_pointer__(): unresolved function pointer
    325.   	free_func(str);
    326.   	if (free_debug_func != NULL)
    327.   		free_debug_func(NULL, 1);
             ^
    328.   	}
    329.   

crypto/mem.c:326:2: 
    324.   #endif
    325.   	free_func(str);
    326. > 	if (free_debug_func != NULL)
    327.   		free_debug_func(NULL, 1);
    328.   	}

crypto/mem.c:328:2: return from a call to CRYPTO_free
    326.   	if (free_debug_func != NULL)
    327.   		free_debug_func(NULL, 1);
    328.   	}
            ^
    329.   
    330.   void *CRYPTO_remalloc(void *a, int num, const char *file, int line)

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

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

crypto/rsa/rsa_sign.c:222:1: 
220.   			ret=1;
221.   	}
222. > err:
223.   	if (sig != NULL) X509_SIG_free(sig);
224.   	memset(s,0,(unsigned int)siglen);

crypto/rsa/rsa_sign.c:223:6: Taking false branch
221.   	}
222.   err:
223.   	if (sig != NULL) X509_SIG_free(sig);
            ^
224.   	memset(s,0,(unsigned int)siglen);
225.   	OPENSSL_free(s);

crypto/rsa/rsa_sign.c:224:2: 
222.   err:
223.   	if (sig != NULL) X509_SIG_free(sig);
224. > 	memset(s,0,(unsigned int)siglen);
225.   	OPENSSL_free(s);
226.   	return(ret);
