summaryrefslogtreecommitdiff
path: root/sbin/iked/util.c
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2017-12-13 08:27:07 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2017-12-13 08:27:07 +0000
commit4eab2d9bb2c36c2b29f81f32dc84966be14159c8 (patch)
tree5bdeac51723add0580bbabbfb7e5e2ba8e6bd7ca /sbin/iked/util.c
parente53426413f19e89f08d1071a6c92e64d0656c589 (diff)
getsockname(2) needs to be passed the length of the input struct.
ok jca@
Diffstat (limited to 'sbin/iked/util.c')
-rw-r--r--sbin/iked/util.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sbin/iked/util.c b/sbin/iked/util.c
index 1d4cee2c424..6d1cd5cbc08 100644
--- a/sbin/iked/util.c
+++ b/sbin/iked/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.34 2017/11/29 01:25:11 claudio Exp $ */
+/* $OpenBSD: util.c,v 1.35 2017/12/13 08:27:06 patrick Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -93,7 +93,7 @@ socket_setport(struct sockaddr *sa, in_port_t port)
int
socket_getaddr(int s, struct sockaddr_storage *ss)
{
- socklen_t sslen;
+ socklen_t sslen = sizeof(*ss);
return (getsockname(s, (struct sockaddr *)ss, &sslen));
}
@@ -366,7 +366,6 @@ recvfromto(int s, void *buf, size_t len, int flags, struct sockaddr *from,
return (-1);
*fromlen = from->sa_len;
- *tolen = 0;
if (getsockname(s, to, tolen) != 0)
*tolen = 0;