|
|
- From 30d5fa3841facc188d5332d385069cce394b4dcd Mon Sep 17 00:00:00 2001
- From: Brent Cook <busterb@gmail.com>
- Date: Tue, 30 Dec 2014 09:02:50 -0600
- Subject: [PATCH 03/18] conditionally fill in sin_len/sin6_len if they exist
-
- ---
- src/usr.sbin/ntpd/parse.y | 8 +++++---
- 1 file changed, 5 insertions(+), 3 deletions(-)
-
- diff --git a/src/usr.sbin/ntpd/parse.y b/src/usr.sbin/ntpd/parse.y
- index 81d19bbff4..ab87872cfe 100644
- --- a/src/usr.sbin/ntpd/parse.y
- +++ b/src/usr.sbin/ntpd/parse.y
- @@ -140,15 +140,17 @@ main : LISTEN ON address listen_opts {
-
- 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;
- +#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
- + sin4.sin_len = sizeof(struct sockaddr_in);
- sin6.sin6_len = sizeof(struct sockaddr_in6);
- +#endif
-
- if (inet_pton(AF_INET, $3, &sin4.sin_addr) == 1)
- - memcpy(&query_addr4, &sin4, sin4.sin_len);
- + memcpy(&query_addr4, &sin4, sizeof(struct sockaddr_in));
- else if (inet_pton(AF_INET6, $3, &sin6.sin6_addr) == 1)
- - memcpy(&query_addr6, &sin6, sin6.sin6_len);
- + memcpy(&query_addr6, &sin6, sizeof(struct sockaddr_in6));
- else {
- yyerror("invalid IPv4 or IPv6 address: %s\n",
- $3);
- --
- 2.27.0
-
|