Hello - memcpy can be used on freshly allocated memory. Fill in the free size for it.
OK? Index: netinet/tcp_subr.c =================================================================== RCS file: /cvs/src/sys/netinet/tcp_subr.c,v retrieving revision 1.169 diff -u -p -r1.169 tcp_subr.c --- netinet/tcp_subr.c 18 Mar 2018 21:05:21 -0000 1.169 +++ netinet/tcp_subr.c 31 Mar 2018 19:12:04 -0000 @@ -952,7 +952,7 @@ tcp_signature_tdb_init(struct tdb *tdbp, tdbp->tdb_amxkey = malloc(ii->ii_authkeylen, M_XDATA, M_NOWAIT); if (tdbp->tdb_amxkey == NULL) return (ENOMEM); - bcopy(ii->ii_authkey, tdbp->tdb_amxkey, ii->ii_authkeylen); + memcpy(tdbp->tdb_amxkey, ii->ii_authkey, ii->ii_authkeylen); tdbp->tdb_amxkeylen = ii->ii_authkeylen; return (0); @@ -963,7 +963,7 @@ tcp_signature_tdb_zeroize(struct tdb *td { if (tdbp->tdb_amxkey) { explicit_bzero(tdbp->tdb_amxkey, tdbp->tdb_amxkeylen); - free(tdbp->tdb_amxkey, M_XDATA, 0); + free(tdbp->tdb_amxkey, M_XDATA, tdbp->tdb_amxkeylen); tdbp->tdb_amxkey = NULL; }