summaryrefslogtreecommitdiff
path: root/sbin/iked
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2014-10-12 15:57:01 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2014-10-12 15:57:01 +0000
commitc5ffeef8644bb7246e2ea9a9f35b94f0775ba828 (patch)
treee7b8671e933f064e0b7e0c4cbbb31ff0b49e1338 /sbin/iked
parent8f723f583034fae9d0b8a6c742e1ce000cee9b3a (diff)
DH_compute_key() returns -1 on error but this was not
handled by testing the result with a negation. Ralf Horstmann discovered iked would segfault when connecting from Strongswan on Android because of this and supplied the patch to fix the problem. ok reyk@
Diffstat (limited to 'sbin/iked')
-rw-r--r--sbin/iked/dh.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sbin/iked/dh.c b/sbin/iked/dh.c
index 7a26712a2bb..8fe965dfa46 100644
--- a/sbin/iked/dh.c
+++ b/sbin/iked/dh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dh.c,v 1.14 2014/08/27 10:28:57 reyk Exp $ */
+/* $OpenBSD: dh.c,v 1.15 2014/10/12 15:57:00 jsg Exp $ */
/*
* Copyright (c) 2010-2014 Reyk Floeter <reyk@openbsd.org>
@@ -472,7 +472,7 @@ modp_create_shared(struct group *group, u_int8_t *secret, u_int8_t *exchange)
ret = DH_compute_key(secret, ex, group->dh);
BN_clear_free(ex);
- if (!ret)
+ if (ret <= 0)
return (-1);
/* add zero padding */