diff options
author | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2001-06-07 05:27:53 +0000 |
---|---|---|
committer | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2001-06-07 05:27:53 +0000 |
commit | 02cbe2b174b6482978525a3c6eac82089b038409 (patch) | |
tree | 50ab87d81efa4ad7c97a0f60c6f869291c71baa3 /sys/net/pfkeyv2.c | |
parent | 3cd9cb1f4039c16901d06b552c6f999ff874271e (diff) |
On a pfkeyv2_get(), allocate enough room for the extra stuff we store
in the SA.
Diffstat (limited to 'sys/net/pfkeyv2.c')
-rw-r--r-- | sys/net/pfkeyv2.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c index 136fa2899f4..9a593f8d663 100644 --- a/sys/net/pfkeyv2.c +++ b/sys/net/pfkeyv2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkeyv2.c,v 1.64 2001/06/05 02:31:34 deraadt Exp $ */ +/* $OpenBSD: pfkeyv2.c,v 1.65 2001/06/07 05:27:52 angelos Exp $ */ /* * @(#)COPYRIGHT 1.1 (NRL) 17 January 1995 @@ -1147,6 +1147,18 @@ pfkeyv2_get(struct tdb *sa, void **headers, void **buffer) if (sa->tdb_dstid) i += PADUP(sa->tdb_dstid->ref_len) + sizeof(struct sadb_ident); + if (sa->tdb_local_cred) + i += PADUP(sa->tdb_local_cred->ref_len) + sizeof(struct sadb_x_cred); + + if (sa->tdb_remote_cred) + i += PADUP(sa->tdb_remote_cred->ref_len) + sizeof(struct sadb_x_cred); + + if (sa->tdb_local_auth) + i += PADUP(sa->tdb_local_auth->ref_len) + sizeof(struct sadb_x_cred); + + if (sa->tdb_remote_auth) + i += PADUP(sa->tdb_remote_auth->ref_len) + sizeof(struct sadb_x_cred); + if (!(p = malloc(i, M_PFKEY, M_DONTWAIT))) { rval = ENOMEM; |