ssl/ssl_lib.c:1235: error: NULL_DEREFERENCE
  pointer `sk` last assigned on line 1222 could be null and is dereferenced by call to `sk_push()` at line 1235, column 9.
Showing all 34 steps of the trace


ssl/ssl_lib.c:1208:1: start of procedure ssl_bytes_to_cipher_list()
1206.   	}
1207.   
1208. > STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,unsigned char *p,int num,
1209.   					       STACK_OF(SSL_CIPHER) **skp)
1210.   	{

ssl/ssl_lib.c:1215:2: Skipping __function_pointer__(): unresolved function pointer
1213.   	int i,n;
1214.   
1215.   	n=ssl_put_cipher_by_char(s,NULL,NULL);
         ^
1216.   	if ((num%n) != 0)
1217.   		{

ssl/ssl_lib.c:1216:6: Taking false branch
1214.   
1215.   	n=ssl_put_cipher_by_char(s,NULL,NULL);
1216.   	if ((num%n) != 0)
             ^
1217.   		{
1218.   		SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST);

ssl/ssl_lib.c:1221:7: Taking false branch
1219.   		return(NULL);
1220.   		}
1221.   	if ((skp == NULL) || (*skp == NULL))
              ^
1222.   		sk=sk_SSL_CIPHER_new_null(); /* change perhaps later */
1223.   	else

ssl/ssl_lib.c:1221:24: Taking true branch
1219.   		return(NULL);
1220.   		}
1221.   	if ((skp == NULL) || (*skp == NULL))
                               ^
1222.   		sk=sk_SSL_CIPHER_new_null(); /* change perhaps later */
1223.   	else

ssl/ssl_lib.c:1222:3: 
1220.   		}
1221.   	if ((skp == NULL) || (*skp == NULL))
1222. > 		sk=sk_SSL_CIPHER_new_null(); /* change perhaps later */
1223.   	else
1224.   		{

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:291:1: start of procedure CRYPTO_malloc()
      289.   	}
      290.   
      291. > void *CRYPTO_malloc(int num, const char *file, int line)
      292.   	{
      293.   	void *ret = NULL;

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

crypto/mem.c:296:6: Taking false branch
      294.   	extern unsigned char cleanse_ctr;
      295.   
      296.   	if (num < 0) return NULL;
                  ^
      297.   
      298.   	allow_customize = 0;

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

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

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

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

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

crypto/mem.c:317:2: 
      315.                   ((unsigned char *)ret)[0] = cleanse_ctr;
      316.   
      317. > 	return ret;
      318.   	}
      319.   

crypto/mem.c:318:2: return from a call to CRYPTO_malloc
      316.   
      317.   	return ret;
      318.   	}
              ^
      319.   
      320.   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 *))

ssl/ssl_lib.c:1229:7: 
1227.   		}
1228.   
1229. > 	for (i=0; i<num; i+=n)
1230.   		{
1231.   		c=ssl_get_cipher_by_char(s,p);

ssl/ssl_lib.c:1229:12: Loop condition is true. Entering loop body
1227.   		}
1228.   
1229.   	for (i=0; i<num; i+=n)
                   ^
1230.   		{
1231.   		c=ssl_get_cipher_by_char(s,p);

ssl/ssl_lib.c:1231:3: Skipping __function_pointer__(): unresolved function pointer
1229.   	for (i=0; i<num; i+=n)
1230.   		{
1231.   		c=ssl_get_cipher_by_char(s,p);
          ^
1232.   		p+=n;
1233.   		if (c != NULL)

ssl/ssl_lib.c:1232:3: 
1230.   		{
1231.   		c=ssl_get_cipher_by_char(s,p);
1232. > 		p+=n;
1233.   		if (c != NULL)
1234.   			{

ssl/ssl_lib.c:1233:7: Taking true branch
1231.   		c=ssl_get_cipher_by_char(s,p);
1232.   		p+=n;
1233.   		if (c != NULL)
              ^
1234.   			{
1235.   			if (!sk_SSL_CIPHER_push(sk,c))

ssl/ssl_lib.c:1235:9: 
1233.   		if (c != NULL)
1234.   			{
1235. > 			if (!sk_SSL_CIPHER_push(sk,c))
1236.   				{
1237.   				SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,ERR_R_MALLOC_FAILURE);

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.   
