From f3ef710218e26c8b9c782d1aef5a90270c49ac33 Mon Sep 17 00:00:00 2001 From: patrick Date: Wed, 13 Dec 2017 08:27:06 +0000 Subject: [PATCH] getsockname(2) needs to be passed the length of the input struct. ok jca@ --- sbin/iked/util.c | 5 ++--- 1 file 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 @@ -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; -- 2.20.1