Portable build framework for OpenNTPD
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.3 KiB

4 years ago
4 years ago
6 years ago
7 years ago
4 years ago
7 years ago
4 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
4 years ago
  1. From 30d5fa3841facc188d5332d385069cce394b4dcd Mon Sep 17 00:00:00 2001
  2. From: Brent Cook <busterb@gmail.com>
  3. Date: Tue, 30 Dec 2014 09:02:50 -0600
  4. Subject: [PATCH 03/18] conditionally fill in sin_len/sin6_len if they exist
  5. ---
  6. src/usr.sbin/ntpd/parse.y | 8 +++++---
  7. 1 file changed, 5 insertions(+), 3 deletions(-)
  8. diff --git a/src/usr.sbin/ntpd/parse.y b/src/usr.sbin/ntpd/parse.y
  9. index 81d19bbff4..ab87872cfe 100644
  10. --- a/src/usr.sbin/ntpd/parse.y
  11. +++ b/src/usr.sbin/ntpd/parse.y
  12. @@ -140,15 +140,17 @@ main : LISTEN ON address listen_opts {
  13. memset(&sin4, 0, sizeof(sin4));
  14. sin4.sin_family = AF_INET;
  15. - sin4.sin_len = sizeof(struct sockaddr_in);
  16. memset(&sin6, 0, sizeof(sin6));
  17. sin6.sin6_family = AF_INET6;
  18. +#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
  19. + sin4.sin_len = sizeof(struct sockaddr_in);
  20. sin6.sin6_len = sizeof(struct sockaddr_in6);
  21. +#endif
  22. if (inet_pton(AF_INET, $3, &sin4.sin_addr) == 1)
  23. - memcpy(&query_addr4, &sin4, sin4.sin_len);
  24. + memcpy(&query_addr4, &sin4, sizeof(struct sockaddr_in));
  25. else if (inet_pton(AF_INET6, $3, &sin6.sin6_addr) == 1)
  26. - memcpy(&query_addr6, &sin6, sin6.sin6_len);
  27. + memcpy(&query_addr6, &sin6, sizeof(struct sockaddr_in6));
  28. else {
  29. yyerror("invalid IPv4 or IPv6 address: %s\n",
  30. $3);
  31. --
  32. 2.27.0