diff options
author | Hans-Joerg Hoexer <hshoexer@cvs.openbsd.org> | 2004-12-28 11:19:48 +0000 |
---|---|---|
committer | Hans-Joerg Hoexer <hshoexer@cvs.openbsd.org> | 2004-12-28 11:19:48 +0000 |
commit | 417148e7c8ed4061c25ff0cc7beb82bc66535005 (patch) | |
tree | 77272f4c4fae4b9922583750f9874cf33fb024f7 /sbin/isakmpd | |
parent | 8d33036015f44a2b77b897b8f5bd2271c9ac95f9 (diff) |
Correctly determine length of rsa key passed by the kernel to userland. Found
and fix provided by Stefan Miltchev. Again, many thanks!
Slightly different fix.
ok ho@
Diffstat (limited to 'sbin/isakmpd')
-rw-r--r-- | sbin/isakmpd/key.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sbin/isakmpd/key.c b/sbin/isakmpd/key.c index bc3c9fc4c15..57e40db70fa 100644 --- a/sbin/isakmpd/key.c +++ b/sbin/isakmpd/key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: key.c,v 1.19 2004/09/17 13:53:08 ho Exp $ */ +/* $OpenBSD: key.c,v 1.20 2004/12/28 11:19:47 hshoexer Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) * @@ -199,7 +199,13 @@ key_from_printable(int type, int private, char *key, u_int8_t **data, *datalenp = 0; return; } - *datalenp = hex2raw(key, *data, datalen); + if (hex2raw(key, *data, datalen)) { + log_error("key_from_printable: invalid hex key"); + free(*data); + *datalenp = 0; + return; + } + *datalenp = datalen; break; #endif |