test/ssltest_old.c:322: error: NULL_DEREFERENCE
  pointer `alpn_selected` last assigned on line 321 could be null and is dereferenced by call to `memcpy()` at line 322, column 5.
Showing all 18 steps of the trace


test/ssltest_old.c:295:1: start of procedure cb_server_alpn()
293.   }
294.   
295. > static int cb_server_alpn(SSL *s, const unsigned char **out,
296.                             unsigned char *outlen, const unsigned char *in,
297.                             unsigned int inlen, void *arg)

test/ssltest_old.c:301:5: 
299.       unsigned char *protos;
300.       size_t protos_len;
301. >     char* alpn_str = arg;
302.   
303.       protos = next_protos_parse(&protos_len, alpn_str);

test/ssltest_old.c:303:5: Skipping next_protos_parse(): empty list of specs
301.       char* alpn_str = arg;
302.   
303.       protos = next_protos_parse(&protos_len, alpn_str);
           ^
304.       if (protos == NULL) {
305.           fprintf(stderr, "failed to parser ALPN server protocol string: %s\n",

test/ssltest_old.c:304:9: Taking false branch
302.   
303.       protos = next_protos_parse(&protos_len, alpn_str);
304.       if (protos == NULL) {
               ^
305.           fprintf(stderr, "failed to parser ALPN server protocol string: %s\n",
306.                   alpn_str);

test/ssltest_old.c:310:9: Taking false branch
308.       }
309.   
310.       if (SSL_select_next_proto
               ^
311.           ((unsigned char **)out, outlen, protos, protos_len, in,
312.            inlen) != OPENSSL_NPN_NEGOTIATED) {

test/ssltest_old.c:321:5: 
319.        * verify_alpn.
320.        */
321. >     alpn_selected = OPENSSL_malloc(*outlen);
322.       memcpy(alpn_selected, *out, *outlen);
323.       *out = alpn_selected;

crypto/mem.c:169:1: start of procedure CRYPTO_malloc()
  167.   #endif
  168.   
  169. > void *CRYPTO_malloc(size_t num, const char *file, int line)
  170.   {
  171.       void *ret = NULL;

crypto/mem.c:171:5: 
  169.   void *CRYPTO_malloc(size_t num, const char *file, int line)
  170.   {
  171. >     void *ret = NULL;
  172.   
  173.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:173:9: Taking true branch
  171.       void *ret = NULL;
  172.   
  173.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                 ^
  174.           return malloc_impl(num, file, line);
  175.   

crypto/mem.c:173:32: Taking false branch
  171.       void *ret = NULL;
  172.   
  173.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                                        ^
  174.           return malloc_impl(num, file, line);
  175.   

crypto/mem.c:176:9: Taking false branch
  174.           return malloc_impl(num, file, line);
  175.   
  176.       if (num == 0)
                 ^
  177.           return NULL;
  178.   

crypto/mem.c:180:5: 
  178.   
  179.       FAILTEST();
  180. >     allow_customize = 0;
  181.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
  182.       if (call_malloc_debug) {

crypto/mem.c:190:5: 
  188.       }
  189.   #else
  190. >     osslargused(file); osslargused(line);
  191.       ret = malloc(num);
  192.   #endif

crypto/mem.c:190:24: 
  188.       }
  189.   #else
  190. >     osslargused(file); osslargused(line);
  191.       ret = malloc(num);
  192.   #endif

crypto/mem.c:191:5: 
  189.   #else
  190.       osslargused(file); osslargused(line);
  191. >     ret = malloc(num);
  192.   #endif
  193.   

crypto/mem.c:194:5: 
  192.   #endif
  193.   
  194. >     return ret;
  195.   }
  196.   

crypto/mem.c:195:1: return from a call to CRYPTO_malloc
  193.   
  194.       return ret;
  195. > }
  196.   
  197.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

test/ssltest_old.c:322:5: 
320.        */
321.       alpn_selected = OPENSSL_malloc(*outlen);
322. >     memcpy(alpn_selected, *out, *outlen);
323.       *out = alpn_selected;
324.   
