ssl/d1_srtp.c:354: error: NULL_DEREFERENCE
  pointer `clnt` last assigned on line 344 could be null and is dereferenced by call to `sk_push()` at line 354, column 4.
Showing all 37 steps of the trace


ssl/d1_srtp.c:305:1: start of procedure ssl_parse_clienthello_use_srtp_ext()
303.   
304.   
305. > int ssl_parse_clienthello_use_srtp_ext(SSL *s, unsigned char *d, int len,int *al)
306.   	{
307.   	SRTP_PROTECTION_PROFILE *cprof,*sprof;

ssl/d1_srtp.c:308:2: 
306.   	{
307.   	SRTP_PROTECTION_PROFILE *cprof,*sprof;
308. > 	STACK_OF(SRTP_PROTECTION_PROFILE) *clnt=0,*srvr;
309.           int ct;
310.           int mki_len;

ssl/d1_srtp.c:316:12: Taking false branch
314.   
315.            /* Length value + the MKI length */
316.           if(len < 3)
                  ^
317.   		{            
318.   		SSLerr(SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT,SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);

ssl/d1_srtp.c:324:9: 
322.   
323.           /* Pull off the length of the cipher suite list */
324. >         n2s(d, ct);
325.           len -= 2;
326.           

ssl/d1_srtp.c:325:9: 
323.           /* Pull off the length of the cipher suite list */
324.           n2s(d, ct);
325. >         len -= 2;
326.           
327.           /* Check that it is even */

ssl/d1_srtp.c:328:5: Taking false branch
326.           
327.           /* Check that it is even */
328.   	if(ct%2)
           ^
329.   		{
330.   		SSLerr(SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT,SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);

ssl/d1_srtp.c:336:5: Taking false branch
334.           
335.           /* Check that lengths are consistent */
336.   	if(len < (ct + 1)) 
           ^
337.   		{
338.   		SSLerr(SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT,SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);

ssl/d1_srtp.c:344:2: 
342.   
343.           
344. > 	clnt=sk_SRTP_PROTECTION_PROFILE_new_null();
345.   
346.   	while(ct)

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

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

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

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

crypto/mem.c:297:1: start of procedure CRYPTO_malloc()
      295.   	}
      296.   
      297. > void *CRYPTO_malloc(int num, const char *file, int line)
      298.   	{
      299.   	void *ret = NULL;

crypto/mem.c:299:2: 
      297.   void *CRYPTO_malloc(int num, const char *file, int line)
      298.   	{
      299. > 	void *ret = NULL;
      300.   
      301.   	if (num <= 0) return NULL;

crypto/mem.c:301:6: Taking false branch
      299.   	void *ret = NULL;
      300.   
      301.   	if (num <= 0) return NULL;
                  ^
      302.   
      303.   	allow_customize = 0;

crypto/mem.c:303:2: 
      301.   	if (num <= 0) return NULL;
      302.   
      303. > 	allow_customize = 0;
      304.   	if (malloc_debug_func != NULL)
      305.   		{

crypto/mem.c:304:6: Taking false branch
      302.   
      303.   	allow_customize = 0;
      304.   	if (malloc_debug_func != NULL)
                  ^
      305.   		{
      306.   		allow_customize_debug = 0;

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

crypto/mem.c:313:6: Taking false branch
      311.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
      312.   #endif
      313.   	if (malloc_debug_func != NULL)
                  ^
      314.   		malloc_debug_func(ret, num, file, line, 1);
      315.   

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

crypto/mem.c:326:2: 
      324.   #endif
      325.   
      326. > 	return ret;
      327.   	}
      328.   char *CRYPTO_strdup(const char *str, const char *file, int line)

crypto/mem.c:327:2: return from a call to CRYPTO_malloc
      325.   
      326.   	return ret;
      327.   	}
              ^
      328.   char *CRYPTO_strdup(const char *str, const char *file, int line)
      329.   	{

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

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

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

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

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

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

ssl/d1_srtp.c:346:8: Loop condition is true. Entering loop body
344.   	clnt=sk_SRTP_PROTECTION_PROFILE_new_null();
345.   
346.   	while(ct)
              ^
347.   		{
348.   		n2s(d,id);

ssl/d1_srtp.c:348:3: 
346.   	while(ct)
347.   		{
348. > 		n2s(d,id);
349.   		ct-=2;
350.                   len-=2;

ssl/d1_srtp.c:349:3: 
347.   		{
348.   		n2s(d,id);
349. > 		ct-=2;
350.                   len-=2;
351.   

ssl/d1_srtp.c:350:17: 
348.   		n2s(d,id);
349.   		ct-=2;
350. >                 len-=2;
351.   
352.   		if(!find_profile_by_num(id,&cprof))

ssl/d1_srtp.c:352:7: Taking true branch
350.                   len-=2;
351.   
352.   		if(!find_profile_by_num(id,&cprof))
             ^
353.   			{
354.   			sk_SRTP_PROTECTION_PROFILE_push(clnt,cprof);

ssl/d1_srtp.c:354:4: Condition is true
352.   		if(!find_profile_by_num(id,&cprof))
353.   			{
354.   			sk_SRTP_PROTECTION_PROFILE_push(clnt,cprof);
          ^
355.   			}
356.   		else

ssl/d1_srtp.c:354:4: Condition is true
352.   		if(!find_profile_by_num(id,&cprof))
353.   			{
354.   			sk_SRTP_PROTECTION_PROFILE_push(clnt,cprof);
          ^
355.   			}
356.   		else

crypto/stack/stack.c:244:1: start of procedure sk_push()
  242.   	}
  243.   
  244. > int sk_push(_STACK *st, void *data)
  245.   	{
  246.   	return(sk_insert(st,data,st->num));

crypto/stack/stack.c:246:2: Skipping sk_insert(): empty list of specs
  244.   int sk_push(_STACK *st, void *data)
  245.   	{
  246.   	return(sk_insert(st,data,st->num));
          ^
  247.   	}
  248.   
