summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2004-06-22 18:22:19 +0000
committerHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2004-06-22 18:22:19 +0000
commitf4f40ac6088b00e411084982e3e0e3e65550ab6c (patch)
treef4d80f3964ff20d1ae83cef6168e15caef184755
parent5b06df035794b5320bac4bcbfddf4b88da03021b (diff)
kn_get_string() may return NULL on failure. Handle this corrctly.
with msf@, ok ho@ markus@
-rw-r--r--sbin/isakmpd/ike_auth.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sbin/isakmpd/ike_auth.c b/sbin/isakmpd/ike_auth.c
index bcbf94323fc..72816f12533 100644
--- a/sbin/isakmpd/ike_auth.c
+++ b/sbin/isakmpd/ike_auth.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ike_auth.c,v 1.92 2004/06/20 17:17:34 ho Exp $ */
+/* $OpenBSD: ike_auth.c,v 1.93 2004/06/22 18:22:18 hshoexer Exp $ */
/* $EOM: ike_auth.c,v 1.59 2000/11/21 00:21:31 angelos Exp $ */
/*
@@ -256,9 +256,10 @@ ike_auth_get_key(int type, char *id, char *local_id, size_t *keylen)
buf2 = kn_get_string(buf);
free(buf);
- if (kn_decode_key(&dc, buf2, KEYNOTE_PRIVATE_KEY)
- == -1) {
- free(buf2);
+ if (!buf2 || kn_decode_key(&dc, buf2,
+ KEYNOTE_PRIVATE_KEY) == -1) {
+ if (buf2)
+ free(buf2);
log_print("ike_auth_get_key: failed decoding "
"key in \"%s\"", keyfile);
free(keyfile);