* The constructors weren't defined in declaration order.
* Unflatten() will now check whether the size of the buffer was large enough to hold a valid address. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39693 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2115850c7e
commit
19b4490fd2
@ -16,6 +16,12 @@
|
||||
#include <sys/sockio.h>
|
||||
|
||||
|
||||
BNetworkAddress::BNetworkAddress()
|
||||
{
|
||||
Unset();
|
||||
}
|
||||
|
||||
|
||||
BNetworkAddress::BNetworkAddress(const char* host, uint16 port, uint32 flags)
|
||||
{
|
||||
SetTo(host, port, flags);
|
||||
@ -93,12 +99,6 @@ BNetworkAddress::BNetworkAddress(const BNetworkAddress& other)
|
||||
}
|
||||
|
||||
|
||||
BNetworkAddress::BNetworkAddress()
|
||||
{
|
||||
Unset();
|
||||
}
|
||||
|
||||
|
||||
BNetworkAddress::~BNetworkAddress()
|
||||
{
|
||||
}
|
||||
@ -995,6 +995,11 @@ BNetworkAddress::Unflatten(type_code code, const void* buffer, ssize_t size)
|
||||
return fStatus = B_BAD_TYPE;
|
||||
|
||||
memcpy(&fAddress, buffer, min_c(size, (ssize_t)sizeof(fAddress)));
|
||||
|
||||
// check if this can contain a valid address
|
||||
if (fAddress.ss_family != AF_UNSPEC && size < (ssize_t)sizeof(sockaddr))
|
||||
return fStatus = B_BAD_VALUE;
|
||||
|
||||
return fStatus = B_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user