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


ssl/ssl_lib.c:899:1: start of procedure ssl_bytes_to_cipher_list()
897.   	}
898.   
899. > STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,unsigned char *p,int num,
900.   					       STACK_OF(SSL_CIPHER) **skp)
901.   	{

ssl/ssl_lib.c:906:2: Skipping __function_pointer__(): unresolved function pointer
904.   	int i,n;
905.   
906.   	n=ssl_put_cipher_by_char(s,NULL,NULL);
        ^
907.   	if ((num%n) != 0)
908.   		{

ssl/ssl_lib.c:907:6: Taking false branch
905.   
906.   	n=ssl_put_cipher_by_char(s,NULL,NULL);
907.   	if ((num%n) != 0)
            ^
908.   		{
909.   		SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST);

ssl/ssl_lib.c:912:7: Taking false branch
910.   		return(NULL);
911.   		}
912.   	if ((skp == NULL) || (*skp == NULL))
             ^
913.   		sk=sk_SSL_CIPHER_new(NULL); /* change perhaps later */
914.   	else

ssl/ssl_lib.c:912:24: Taking true branch
910.   		return(NULL);
911.   		}
912.   	if ((skp == NULL) || (*skp == NULL))
                              ^
913.   		sk=sk_SSL_CIPHER_new(NULL); /* change perhaps later */
914.   	else

ssl/ssl_lib.c:913:3: 
911.   		}
912.   	if ((skp == NULL) || (*skp == NULL))
913. > 		sk=sk_SSL_CIPHER_new(NULL); /* change perhaps later */
914.   	else
915.   		{

ssl/ssl_lib.c:1887:1: start of procedure sk_SSL_CIPHER_new()
  1885.   #endif
  1886.   
  1887. > IMPLEMENT_STACK_OF(SSL_CIPHER)
  1888.   IMPLEMENT_STACK_OF(SSL_COMP)

crypto/stack/stack.c:112:1: start of procedure sk_new()
    110.   	}
    111.   
    112. > STACK *sk_new(int (*c)())
    113.   	{
    114.   	STACK *ret;

crypto/stack/stack.c:117:6: Taking true branch
    115.   	int i;
    116.   
    117.   	if ((ret=(STACK *)Malloc(sizeof(STACK))) == NULL)
                ^
    118.   		goto err0;
    119.   	if ((ret->data=(char **)Malloc(sizeof(char *)*MIN_NODES)) == NULL)

crypto/stack/stack.c:130:1: 
    128.   err1:
    129.   	Free((char *)ret);
    130. > err0:
    131.   	return(NULL);
    132.   	}

crypto/stack/stack.c:131:2: 
    129.   	Free((char *)ret);
    130.   err0:
    131. > 	return(NULL);
    132.   	}
    133.   

crypto/stack/stack.c:132:2: return from a call to sk_new
    130.   err0:
    131.   	return(NULL);
    132.   	}
            ^
    133.   
    134.   int sk_insert(STACK *st, char *data, int loc)

ssl/ssl_lib.c:1887:1: return from a call to sk_SSL_CIPHER_new
  1885.   #endif
  1886.   
  1887. > IMPLEMENT_STACK_OF(SSL_CIPHER)
  1888.   IMPLEMENT_STACK_OF(SSL_COMP)

ssl/ssl_lib.c:920:7: 
918.   		}
919.   
920. > 	for (i=0; i<num; i+=n)
921.   		{
922.   		c=ssl_get_cipher_by_char(s,p);

ssl/ssl_lib.c:920:12: Loop condition is true. Entering loop body
918.   		}
919.   
920.   	for (i=0; i<num; i+=n)
                  ^
921.   		{
922.   		c=ssl_get_cipher_by_char(s,p);

ssl/ssl_lib.c:922:3: Skipping __function_pointer__(): unresolved function pointer
920.   	for (i=0; i<num; i+=n)
921.   		{
922.   		c=ssl_get_cipher_by_char(s,p);
         ^
923.   		p+=n;
924.   		if (c != NULL)

ssl/ssl_lib.c:923:3: 
921.   		{
922.   		c=ssl_get_cipher_by_char(s,p);
923. > 		p+=n;
924.   		if (c != NULL)
925.   			{

ssl/ssl_lib.c:924:7: Taking true branch
922.   		c=ssl_get_cipher_by_char(s,p);
923.   		p+=n;
924.   		if (c != NULL)
             ^
925.   			{
926.   			if (!sk_SSL_CIPHER_push(sk,c))

ssl/ssl_lib.c:926:9: 
924.   		if (c != NULL)
925.   			{
926. > 			if (!sk_SSL_CIPHER_push(sk,c))
927.   				{
928.   				SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,ERR_R_MALLOC_FAILURE);

ssl/ssl_lib.c:1887:1: start of procedure sk_SSL_CIPHER_push()
  1885.   #endif
  1886.   
  1887. > IMPLEMENT_STACK_OF(SSL_CIPHER)
  1888.   IMPLEMENT_STACK_OF(SSL_COMP)

crypto/stack/stack.c:237:1: start of procedure sk_push()
    235.   	}
    236.   
    237. > int sk_push(STACK *st, char *data)
    238.   	{
    239.   	return(sk_insert(st,data,st->num));

crypto/stack/stack.c:239:2: Skipping sk_insert(): empty list of specs
    237.   int sk_push(STACK *st, char *data)
    238.   	{
    239.   	return(sk_insert(st,data,st->num));
            ^
    240.   	}
    241.   

STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,unsigned char *p,int num,
					       STACK_OF(SSL_CIPHER) **skp)
	{
	SSL_CIPHER *c;
	STACK_OF(SSL_CIPHER) *sk;
	int i,n;
	n=ssl_put_cipher_by_char(s,NULL,NULL);
	if ((num%n) != 0)
		{
		SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST);
		return(NULL);
		}
	if ((skp == NULL) || (*skp == NULL))
		sk=sk_SSL_CIPHER_new(NULL);
	else
		{
		sk= *skp;
		sk_SSL_CIPHER_zero(sk);
		}
	for (i=0; i<num; i+=n)
		{
		c=ssl_get_cipher_by_char(s,p);
		p+=n;
		if (c != NULL)
			{
			if (!sk_SSL_CIPHER_push(sk,c))
				{
				SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,ERR_R_MALLOC_FAILURE);
				goto err;
				}
			}
		}
	if (skp != NULL)
		*skp=sk;
	return(sk);
err:
	if ((skp == NULL) || (*skp == NULL))
		sk_SSL_CIPHER_free(sk);
	return(NULL);
	}
['STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,unsigned char *p,int num,\n\t\t\t\t\t       STACK_OF(SSL_CIPHER) **skp)\n\t{\n\tSSL_CIPHER *c;\n\tSTACK_OF(SSL_CIPHER) *sk;\n\tint i,n;\n\tn=ssl_put_cipher_by_char(s,NULL,NULL);\n\tif ((num%n) != 0)\n\t\t{\n\t\tSSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST);\n\t\treturn(NULL);\n\t\t}\n\tif ((skp == NULL) || (*skp == NULL))\n\t\tsk=sk_SSL_CIPHER_new(NULL);\n\telse\n\t\t{\n\t\tsk= *skp;\n\t\tsk_SSL_CIPHER_zero(sk);\n\t\t}\n\tfor (i=0; i<num; i+=n)\n\t\t{\n\t\tc=ssl_get_cipher_by_char(s,p);\n\t\tp+=n;\n\t\tif (c != NULL)\n\t\t\t{\n\t\t\tif (!sk_SSL_CIPHER_push(sk,c))\n\t\t\t\t{\n\t\t\t\tSSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,ERR_R_MALLOC_FAILURE);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tif (skp != NULL)\n\t\t*skp=sk;\n\treturn(sk);\nerr:\n\tif ((skp == NULL) || (*skp == NULL))\n\t\tsk_SSL_CIPHER_free(sk);\n\treturn(NULL);\n\t}', 'STACK *sk_new(int (*c)())\n\t{\n\tSTACK *ret;\n\tint i;\n\tif ((ret=(STACK *)Malloc(sizeof(STACK))) == NULL)\n\t\tgoto err0;\n\tif ((ret->data=(char **)Malloc(sizeof(char *)*MIN_NODES)) == NULL)\n\t\tgoto err1;\n\tfor (i=0; i<MIN_NODES; i++)\n\t\tret->data[i]=NULL;\n\tret->comp=c;\n\tret->num_alloc=MIN_NODES;\n\tret->num=0;\n\tret->sorted=0;\n\treturn(ret);\nerr1:\n\tFree((char *)ret);\nerr0:\n\treturn(NULL);\n\t}', 'int sk_push(STACK *st, char *data)\n\t{\n\treturn(sk_insert(st,data,st->num));\n\t}']