ssl/ssltest.c:442: error: NULL_DEREFERENCE
  pointer `alpn_selected` last assigned on line 441 could be null and is dereferenced by call to `memcpy()` at line 442, column 2.
Showing all 11 steps of the trace


ssl/ssltest.c:421:1: start of procedure cb_server_alpn()
419.   	}
420.   
421. > static int cb_server_alpn(SSL *s, const unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
422.   	{
423.   	unsigned char *protos;

ssl/ssltest.c:426:2: Skipping next_protos_parse(): empty list of specs
424.   	unsigned short protos_len;
425.   
426.   	protos = next_protos_parse(&protos_len, alpn_server);
        ^
427.   	if (protos == NULL)
428.   		{

ssl/ssltest.c:427:6: Taking false branch
425.   
426.   	protos = next_protos_parse(&protos_len, alpn_server);
427.   	if (protos == NULL)
            ^
428.   		{
429.   		fprintf(stderr, "failed to parser ALPN server protocol string: %s\n", alpn_server);

ssl/ssltest.c:433:6: Taking false branch
431.   		}
432.   
433.   	if (SSL_select_next_proto((unsigned char**) out, outlen, protos, protos_len, in, inlen) !=
            ^
434.   	    OPENSSL_NPN_NEGOTIATED)
435.   		{

ssl/ssltest.c:441:2: 
439.   
440.   	/* Make a copy of the selected protocol which will be freed in verify_alpn. */
441. > 	alpn_selected = OPENSSL_malloc(*outlen);
442.   	memcpy(alpn_selected, *out, *outlen);
443.   	*out = alpn_selected;

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 true branch
  299.   	void *ret = NULL;
  300.   
  301.   	if (num <= 0) return NULL;
              ^
  302.   
  303.   	if(allow_customize)

crypto/mem.c:301:16: 
  299.   	void *ret = NULL;
  300.   
  301. > 	if (num <= 0) return NULL;
  302.   
  303.   	if(allow_customize)

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

ssl/ssltest.c:442:2: 
440.   	/* Make a copy of the selected protocol which will be freed in verify_alpn. */
441.   	alpn_selected = OPENSSL_malloc(*outlen);
442. > 	memcpy(alpn_selected, *out, *outlen);
443.   	*out = alpn_selected;
444.   
