From b025a593a7f3a0fe505e8ec32929bdc4fe2cb492 Mon Sep 17 00:00:00 2001 From: Philip Guenther Date: Sat, 21 Jan 2017 11:32:05 +0000 Subject: The POSIX APIs that that sockaddrs all ignore the s*_len field in the incoming socket, so userspace doesn't need to set it unless it has its own reasons for tracking the size along with the sockaddr. ok phessler@ deraadt@ florian@ --- usr.sbin/mrouted/rsrr.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'usr.sbin/mrouted') diff --git a/usr.sbin/mrouted/rsrr.c b/usr.sbin/mrouted/rsrr.c index b038a851003..4bf8183ff8a 100644 --- a/usr.sbin/mrouted/rsrr.c +++ b/usr.sbin/mrouted/rsrr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsrr.c,v 1.14 2015/08/21 02:07:32 deraadt Exp $ */ +/* $OpenBSD: rsrr.c,v 1.15 2017/01/21 11:32:04 guenther Exp $ */ /* $NetBSD: rsrr.c,v 1.3 1995/12/10 10:07:14 mycroft Exp $ */ /* @@ -83,7 +83,6 @@ static void rsrr_cache(struct gtable *gt, struct rsrr_rq *route_query); void rsrr_init(void) { - int servlen; struct sockaddr_un serv_addr; if ((rsrr_socket = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0) @@ -93,11 +92,8 @@ rsrr_init(void) bzero((char *) &serv_addr, sizeof(serv_addr)); serv_addr.sun_family = AF_UNIX; strlcpy(serv_addr.sun_path, RSRR_SERV_PATH, sizeof serv_addr.sun_path); - servlen = offsetof(struct sockaddr_un, sun_path) + - strlen(serv_addr.sun_path); - serv_addr.sun_len = servlen; - if (bind(rsrr_socket, (struct sockaddr *) &serv_addr, servlen) < 0) + if (bind(rsrr_socket, (struct sockaddr *)&serv_addr, sizeof serv_addr) < 0) logit(LOG_ERR, errno, "Can't bind RSRR socket"); if (register_input_handler(rsrr_socket,rsrr_read) < 0) -- cgit v1.2.3