fixed host conversion length check

This commit is contained in:
Martin Willi
2007-01-03 09:25:57 +00:00
parent 6b50ddfa0d
commit 60d79e496b
+2 -2
View File
@@ -428,7 +428,7 @@ static void receive_messages(private_kernel_interface_t *this)
static void host2xfrm(host_t *host, xfrm_address_t *xfrm) static void host2xfrm(host_t *host, xfrm_address_t *xfrm)
{ {
chunk_t chunk = host->get_address(host); chunk_t chunk = host->get_address(host);
memcpy(xfrm, chunk.ptr, max(chunk.len, sizeof(xfrm_address_t))); memcpy(xfrm, chunk.ptr, min(chunk.len, sizeof(xfrm_address_t)));
} }
/** /**
@@ -631,7 +631,7 @@ static status_t add_sa(private_kernel_interface_t *this,
rthdr = XFRM_RTA_NEXT(rthdr); rthdr = XFRM_RTA_NEXT(rthdr);
} }
if (send_message(this, hdr, &response) != SUCCESS) if (send_message(this, hdr, &response) != SUCCESS)
{ {
DBG1(DBG_KNL, "netlink communication failed"); DBG1(DBG_KNL, "netlink communication failed");