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


crypto/rsa/rsa_saos.c:103:1: start of procedure RSA_verify_ASN1_OCTET_STRING()
101.   	}
102.   
103. > int RSA_verify_ASN1_OCTET_STRING(int dtype, unsigned char *m,
104.   	     unsigned int m_len, unsigned char *sigbuf, unsigned int siglen,
105.   	     RSA *rsa)

crypto/rsa/rsa_saos.c:107:2: 
105.   	     RSA *rsa)
106.   	{
107. > 	int i,ret=0;
108.   	unsigned char *p,*s;
109.   	ASN1_OCTET_STRING *sig=NULL;

crypto/rsa/rsa_saos.c:109:2: 
107.   	int i,ret=0;
108.   	unsigned char *p,*s;
109. > 	ASN1_OCTET_STRING *sig=NULL;
110.   
111.   	if (siglen != (unsigned int)RSA_size(rsa))

crypto/rsa/rsa_saos.c:111:6: 
109.   	ASN1_OCTET_STRING *sig=NULL;
110.   
111. > 	if (siglen != (unsigned int)RSA_size(rsa))
112.   		{
113.   		RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING,RSA_R_WRONG_SIGNATURE_LENGTH);

crypto/rsa/rsa_lib.c:213:1: start of procedure RSA_size()
  211.   	}
  212.   
  213. > int RSA_size(RSA *r)
  214.   	{
  215.   	return(BN_num_bytes(r->n));

crypto/rsa/rsa_lib.c:215:2: 
  213.   int RSA_size(RSA *r)
  214.   	{
  215. > 	return(BN_num_bytes(r->n));
  216.   	}
  217.   

crypto/bn/bn_lib.c:238:1: start of procedure BN_num_bits()
    236.   	}
    237.   
    238. > int BN_num_bits(const BIGNUM *a)
    239.   	{
    240.   	BN_ULONG l;

crypto/bn/bn_lib.c:245:6: Taking false branch
    243.   	bn_check_top(a);
    244.   
    245.   	if (a->top == 0) return(0);
                ^
    246.   	l=a->d[a->top-1];
    247.   	i=(a->top-1)*BN_BITS2;

crypto/bn/bn_lib.c:246:2: 
    244.   
    245.   	if (a->top == 0) return(0);
    246. > 	l=a->d[a->top-1];
    247.   	i=(a->top-1)*BN_BITS2;
    248.   	if (l == 0)

crypto/bn/bn_lib.c:247:2: 
    245.   	if (a->top == 0) return(0);
    246.   	l=a->d[a->top-1];
    247. > 	i=(a->top-1)*BN_BITS2;
    248.   	if (l == 0)
    249.   		{

crypto/bn/bn_lib.c:248:6: Taking false branch
    246.   	l=a->d[a->top-1];
    247.   	i=(a->top-1)*BN_BITS2;
    248.   	if (l == 0)
                ^
    249.   		{
    250.   #if !defined(NO_STDIO) && !defined(WIN16)

crypto/bn/bn_lib.c:255:2: Skipping BN_num_bits_word(): empty list of specs
    253.   		abort();
    254.   		}
    255.   	return(i+BN_num_bits_word(l));
            ^
    256.   	}
    257.   

crypto/bn/bn_lib.c:256:2: return from a call to BN_num_bits
    254.   		}
    255.   	return(i+BN_num_bits_word(l));
    256.   	}
            ^
    257.   
    258.   void BN_clear_free(BIGNUM *a)

crypto/rsa/rsa_lib.c:216:2: return from a call to RSA_size
  214.   	{
  215.   	return(BN_num_bytes(r->n));
  216.   	}
          ^
  217.   
  218.   int RSA_public_encrypt(int flen, unsigned char *from, unsigned char *to,

crypto/rsa/rsa_saos.c:111:6: Taking false branch
109.   	ASN1_OCTET_STRING *sig=NULL;
110.   
111.   	if (siglen != (unsigned int)RSA_size(rsa))
            ^
112.   		{
113.   		RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING,RSA_R_WRONG_SIGNATURE_LENGTH);

crypto/rsa/rsa_saos.c:117:2: 
115.   		}
116.   
117. > 	s=(unsigned char *)OPENSSL_malloc((unsigned int)siglen);
118.   	if (s == NULL)
119.   		{

crypto/mem.c:205:1: start of procedure CRYPTO_malloc()
  203.   	}
  204.   
  205. > void *CRYPTO_malloc(int num, const char *file, int line)
  206.   	{
  207.   	void *ret = NULL;

crypto/mem.c:207:2: 
  205.   void *CRYPTO_malloc(int num, const char *file, int line)
  206.   	{
  207. > 	void *ret = NULL;
  208.   
  209.   	allow_customize = 0;

crypto/mem.c:209:2: 
  207.   	void *ret = NULL;
  208.   
  209. > 	allow_customize = 0;
  210.   	if (malloc_debug_func != NULL)
  211.   		{

crypto/mem.c:210:6: Taking false branch
  208.   
  209.   	allow_customize = 0;
  210.   	if (malloc_debug_func != NULL)
              ^
  211.   		{
  212.   		allow_customize_debug = 0;

crypto/mem.c:215:2: Skipping __function_pointer__(): unresolved function pointer
  213.   		malloc_debug_func(NULL, num, file, line, 0);
  214.   		}
  215.   	ret = malloc_func(num);
          ^
  216.   #ifdef LEVITTE_DEBUG
  217.   	fprintf(stderr, "LEVITTE_DEBUG:         > 0x%p (%d)\n", ret, num);

crypto/mem.c:219:6: Taking false branch
  217.   	fprintf(stderr, "LEVITTE_DEBUG:         > 0x%p (%d)\n", ret, num);
  218.   #endif
  219.   	if (malloc_debug_func != NULL)
              ^
  220.   		malloc_debug_func(ret, num, file, line, 1);
  221.   

crypto/mem.c:222:2: 
  220.   		malloc_debug_func(ret, num, file, line, 1);
  221.   
  222. > 	return ret;
  223.   	}
  224.   

crypto/mem.c:223:2: return from a call to CRYPTO_malloc
  221.   
  222.   	return ret;
  223.   	}
          ^
  224.   
  225.   void *CRYPTO_realloc(void *str, int num, const char *file, int line)

crypto/rsa/rsa_saos.c:118:6: Taking true branch
116.   
117.   	s=(unsigned char *)OPENSSL_malloc((unsigned int)siglen);
118.   	if (s == NULL)
            ^
119.   		{
120.   		RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE);

crypto/rsa/rsa_saos.c:120:3: 
118.   	if (s == NULL)
119.   		{
120. > 		RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE);
121.   		goto err;
122.   		}

crypto/err/err.c:353:1: start of procedure ERR_put_error()
  351.   /********************************************************/
  352.   
  353. > void ERR_put_error(int lib, int func, int reason, const char *file,
  354.   	     int line)
  355.   	{

crypto/err/err.c:377:2: Skipping ERR_get_state(): empty list of specs
  375.   	}
  376.   #endif
  377.   	es=ERR_get_state();
          ^
  378.   
  379.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:379:2: 
  377.   	es=ERR_get_state();
  378.   
  379. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
  380.   	if (es->top == es->bottom)
  381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:380:6: Taking false branch
  378.   
  379.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
  380.   	if (es->top == es->bottom)
              ^
  381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
  382.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:382:2: 
  380.   	if (es->top == es->bottom)
  381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
  382. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
  383.   	es->err_file[es->top]=file;
  384.   	es->err_line[es->top]=line;

crypto/err/err.c:383:2: 
  381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
  382.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
  383. > 	es->err_file[es->top]=file;
  384.   	es->err_line[es->top]=line;
  385.   	err_clear_data(es,es->top);

crypto/err/err.c:384:2: 
  382.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
  383.   	es->err_file[es->top]=file;
  384. > 	es->err_line[es->top]=line;
  385.   	err_clear_data(es,es->top);
  386.   	}

crypto/err/err.c:385:2: Taking true branch
  383.   	es->err_file[es->top]=file;
  384.   	es->err_line[es->top]=line;
  385.   	err_clear_data(es,es->top);
          ^
  386.   	}
  387.   

crypto/err/err.c:385:2: Taking true branch
  383.   	es->err_file[es->top]=file;
  384.   	es->err_line[es->top]=line;
  385.   	err_clear_data(es,es->top);
          ^
  386.   	}
  387.   

crypto/mem.c:241:1: start of procedure CRYPTO_free()
    239.   	}
    240.   
    241. > void CRYPTO_free(void *str)
    242.   	{
    243.   	if (free_debug_func != NULL)

crypto/mem.c:243:6: Taking true branch
    241.   void CRYPTO_free(void *str)
    242.   	{
    243.   	if (free_debug_func != NULL)
                ^
    244.   		free_debug_func(str, 0);
    245.   #ifdef LEVITTE_DEBUG

crypto/mem.c:244:3: Skipping __function_pointer__(): unresolved function pointer
    242.   	{
    243.   	if (free_debug_func != NULL)
    244.   		free_debug_func(str, 0);
             ^
    245.   #ifdef LEVITTE_DEBUG
    246.   	fprintf(stderr, "LEVITTE_DEBUG:         < 0x%p\n", str);

crypto/mem.c:248:2: Skipping __function_pointer__(): unresolved function pointer
    246.   	fprintf(stderr, "LEVITTE_DEBUG:         < 0x%p\n", str);
    247.   #endif
    248.   	free_func(str);
            ^
    249.   	if (free_debug_func != NULL)
    250.   		free_debug_func(NULL, 1);

crypto/mem.c:249:6: Taking true branch
    247.   #endif
    248.   	free_func(str);
    249.   	if (free_debug_func != NULL)
                ^
    250.   		free_debug_func(NULL, 1);
    251.   	}

crypto/mem.c:250:3: Skipping __function_pointer__(): unresolved function pointer
    248.   	free_func(str);
    249.   	if (free_debug_func != NULL)
    250.   		free_debug_func(NULL, 1);
             ^
    251.   	}
    252.   

crypto/mem.c:249:2: 
    247.   #endif
    248.   	free_func(str);
    249. > 	if (free_debug_func != NULL)
    250.   		free_debug_func(NULL, 1);
    251.   	}

crypto/mem.c:251:2: return from a call to CRYPTO_free
    249.   	if (free_debug_func != NULL)
    250.   		free_debug_func(NULL, 1);
    251.   	}
            ^
    252.   
    253.   void *CRYPTO_remalloc(void *a, int num, const char *file, int line)

crypto/err/err.c:385:2: 
  383.   	es->err_file[es->top]=file;
  384.   	es->err_line[es->top]=line;
  385. > 	err_clear_data(es,es->top);
  386.   	}
  387.   

crypto/err/err.c:386:2: return from a call to ERR_put_error
  384.   	es->err_line[es->top]=line;
  385.   	err_clear_data(es,es->top);
  386.   	}
          ^
  387.   
  388.   void ERR_clear_error(void)

crypto/rsa/rsa_saos.c:138:1: 
136.   	else
137.   		ret=1;
138. > err:
139.   	if (sig != NULL) M_ASN1_OCTET_STRING_free(sig);
140.   	memset(s,0,(unsigned int)siglen);

crypto/rsa/rsa_saos.c:139:6: Taking false branch
137.   		ret=1;
138.   err:
139.   	if (sig != NULL) M_ASN1_OCTET_STRING_free(sig);
            ^
140.   	memset(s,0,(unsigned int)siglen);
141.   	OPENSSL_free(s);

crypto/rsa/rsa_saos.c:140:2: 
138.   err:
139.   	if (sig != NULL) M_ASN1_OCTET_STRING_free(sig);
140. > 	memset(s,0,(unsigned int)siglen);
141.   	OPENSSL_free(s);
142.   	return(ret);
