[
https://issues.apache.org/jira/browse/THRIFT-3502?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15069976#comment-15069976
]
ASF GitHub Bot commented on THRIFT-3502:
----------------------------------------
GitHub user jeremyspiegel opened a pull request:
https://github.com/apache/thrift/pull/761
THRIFT-3502: C++ TServerSocket passes small buffer to getsockname
When binding with a port number of 0, TServerSocket::listen calls
getsockname to retrieve the bound port number. The previous code was
passing too small a buffer as a parameter, failing on Windows with
errno 2 and WSAGetLastError WSAEFAULT. This change fixes the issue by
using struct sockaddr_storage instead of struct sockaddr as the
parameter buffer.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/jeremyspiegel/thrift THRIFT-3502
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/thrift/pull/761.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #761
----
commit 2758427b001d01e270d7b8181591e5d9aa20860f
Author: Jeremy Spiegel <[email protected]>
Date: 2015-12-23T00:19:20Z
THRIFT-3502: C++ TServerSocket passes small buffer to getsockname
When binding with a port number of 0, TServerSocket::listen calls
getsockname to retrieve the bound port number. The previous code was
passing too small a buffer as a parameter, failing on Windows with
errno 2 and WSAGetLastError WSAEFAULT. This change fixes the issue by
using struct sockaddr_storage instead of struct sockaddr as the
parameter buffer.
----
> C++ TServerSocket passes small buffer to getsockname
> ----------------------------------------------------
>
> Key: THRIFT-3502
> URL: https://issues.apache.org/jira/browse/THRIFT-3502
> Project: Thrift
> Issue Type: Bug
> Components: C++ - Library
> Environment: Microsoft Visual Studio 2015
> Reporter: Jeremy Spiegel
>
> TServerSocket::listen is using a struct sockaddr instead of a struct
> sockaddr_storage when calling getsockname. It then fails to get the bound
> port number when the configured port is 0. See the following stackoverflow
> post:
> http://stackoverflow.com/questions/14624427/wsaefault-error-when-use-getsockname-function
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)