don't copy address info ifg getpeername fails

This commit is contained in:
Richard Frith-Macdonald 2018-02-04 10:10:57 +00:00
parent 4f50f358c3
commit 890eaa9d32

View file

@ -2094,10 +2094,12 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
h = [[[self class] alloc] initWithFileDescriptor: desc
closeOnDealloc: YES];
h->isSocket = YES;
getpeername(desc, &sin, &size);
[h setAddr: &sin];
if (getpeername(desc, &sin, &size) >= 0)
{
[h setAddr: &sin];
}
[readInfo setObject: h
forKey: NSFileHandleNotificationFileHandleItem];
forKey: NSFileHandleNotificationFileHandleItem];
RELEASE(h);
}
[self postReadNotification];