Revert "Fix mosh-server segfault on startup when run without arguments"
This reverts commit 578db45fbf.
The NULL inputs to getaddrinfo are valid in certain cases, and at
least in the case of node, important. The segfault happens not with
getaddrinfo, but with the error message generation below it.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
@@ -205,8 +205,7 @@ public:
|
|||||||
AddrInfo( const char *node, const char *service,
|
AddrInfo( const char *node, const char *service,
|
||||||
const struct addrinfo *hints ) :
|
const struct addrinfo *hints ) :
|
||||||
res( NULL ) {
|
res( NULL ) {
|
||||||
int errcode = getaddrinfo( node ? node : "0",
|
int errcode = getaddrinfo( node, service, hints, &res );
|
||||||
service ? service : "0", hints, &res );
|
|
||||||
if ( errcode != 0 ) {
|
if ( errcode != 0 ) {
|
||||||
throw NetworkException( std::string( "Bad IP address (" ) + node + "): " + gai_strerror( errcode ), 0 );
|
throw NetworkException( std::string( "Bad IP address (" ) + node + "): " + gai_strerror( errcode ), 0 );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user