summaryrefslogtreecommitdiff
path: root/sbin/isakmpd/ipsec.c
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2010-01-10 12:39:44 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2010-01-10 12:39:44 +0000
commit20a5ad21a165c521787d37a793783e6f12101c59 (patch)
treec830c92dfc1f93a2f5870454ad0e5abbefc9ca93 /sbin/isakmpd/ipsec.c
parentce04fd2bd6c5d214b1dd2e216264a172bbc9666a (diff)
only substract ISAKMP_ID_DATA_OFF once. otherwise 'buf' might overflow
and/or ASN1-DNs get not parsed correctly; with and ok krw@; ok reyk@
Diffstat (limited to 'sbin/isakmpd/ipsec.c')
-rw-r--r--sbin/isakmpd/ipsec.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sbin/isakmpd/ipsec.c b/sbin/isakmpd/ipsec.c
index 47af8f41dcd..70e696a31ea 100644
--- a/sbin/isakmpd/ipsec.c
+++ b/sbin/isakmpd/ipsec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipsec.c,v 1.132 2009/01/29 10:05:50 hshoexer Exp $ */
+/* $OpenBSD: ipsec.c,v 1.133 2010/01/10 12:39:43 markus Exp $ */
/* $EOM: ipsec.c,v 1.143 2000/12/11 23:57:42 niklas Exp $ */
/*
@@ -2464,7 +2464,7 @@ ipsec_id_string(u_int8_t *id, size_t id_len)
* estimate.
*/
size = MAX(sizeof "ipv6/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
- sizeof "asn1_dn/" + id_len - ISAKMP_ID_DATA_OFF);
+ sizeof "asn1_dn/" + id_len);
buf = malloc(size);
if (!buf)
/* XXX Log? */
@@ -2502,8 +2502,7 @@ ipsec_id_string(u_int8_t *id, size_t id_len)
case IPSEC_ID_DER_ASN1_DN:
strlcpy(buf, "asn1_dn/", size);
len = strlen(buf);
- addrstr = x509_DN_string(id + ISAKMP_ID_DATA_OFF,
- id_len - ISAKMP_ID_DATA_OFF);
+ addrstr = x509_DN_string(id + ISAKMP_ID_DATA_OFF, id_len);
if (!addrstr)
goto fail;
if (size < len + strlen(addrstr) + 1)