From 8082e3406533c649454379be0f563090ca39d182 Mon Sep 17 00:00:00 2001 From: naddy <> Date: Fri, 11 Aug 2017 19:12:21 +0000 Subject: [PATCH] zero out sockaddr_in before use; fixes use of stack garbage as port number in "query from"; ok phessler@ job@ --- src/usr.sbin/ntpd/parse.y | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/usr.sbin/ntpd/parse.y b/src/usr.sbin/ntpd/parse.y index af4ad173..41fa9ba1 100644 --- a/src/usr.sbin/ntpd/parse.y +++ b/src/usr.sbin/ntpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.66 2017/05/30 23:30:48 benno Exp $ */ +/* $OpenBSD: parse.y,v 1.67 2017/08/11 19:12:21 naddy Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer @@ -136,8 +136,10 @@ main : LISTEN ON address listen_opts { struct sockaddr_in sin4; struct sockaddr_in6 sin6; + memset(&sin4, 0, sizeof(sin4)); sin4.sin_family = AF_INET; sin4.sin_len = sizeof(struct sockaddr_in); + memset(&sin6, 0, sizeof(sin6)); sin6.sin6_family = AF_INET6; sin6.sin6_len = sizeof(struct sockaddr_in6);