diff options
author | Kinsey Moore <kinsey.moore@oarcorp.com> | 2023-09-21 13:31:56 -0500 |
---|---|---|
committer | Joel Sherrill <joel@rtems.org> | 2023-09-23 09:47:41 -0500 |
commit | ddac88a9555e918501c617fa38cfeec6d04b34af (patch) | |
tree | 14ba0d582e135e460a7c5f5f8a2b86090e627d07 | |
parent | bsd/ntpq: Add an output buffer and size to the ntpq query (diff) | |
download | rtems-net-services-ddac88a9555e918501c617fa38cfeec6d04b34af.tar.bz2 |
bsd/ntpq: Use the correct address length
lwIP includes more than the bare address structures in its accounting of
the total addrinfo struct size. Ensure that lwIP gets the correct
address size.
-rw-r--r-- | bsd/freebsd/contrib/ntp/ntpq/ntpq.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/bsd/freebsd/contrib/ntp/ntpq/ntpq.c b/bsd/freebsd/contrib/ntp/ntpq/ntpq.c index 1cea922..0ea6c08 100644 --- a/bsd/freebsd/contrib/ntp/ntpq/ntpq.c +++ b/bsd/freebsd/contrib/ntp/ntpq/ntpq.c @@ -828,6 +828,14 @@ openhost( #ifdef SYS_VXWORKS (connect(sockfd, (struct sockaddr *)&hostaddr, sizeof(hostaddr)) == -1) +#elif defined(__rtems__) + /* + * lwIP's ai_addrlen covers the entire struct which includes + * padding for extra data and is not accurate for calls which + * validate the size of the address structure. Use sa_len instead + */ + (connect(sockfd, (struct sockaddr *)ai->ai_addr, + ai->ai_addr->sa_len) == -1) #else (connect(sockfd, (struct sockaddr *)ai->ai_addr, ai->ai_addrlen) == -1) |