Discard a packet that exceeds the receive buffer

This commit is contained in:
Martin Willi
2010-08-11 10:52:59 +02:00
parent 10a2e09b55
commit aea735ef63
3 changed files with 15 additions and 0 deletions
@@ -212,6 +212,11 @@ METHOD(socket_t, receiver, status_t,
DBG1(DBG_NET, "error reading socket: %s", strerror(errno));
return FAILED;
}
if (msg.msg_flags & MSG_TRUNC)
{
DBG1(DBG_NET, "receive buffer too small, packet discarded");
return FAILED;
}
DBG3(DBG_NET, "received packet %b", buffer, bytes_read);
if (bytes_read < MARKER_LEN)