forked from Bananymous/banan-os
Kernel: Don't crash the kernel if packet is smaller than ethernet hdr
This commit is contained in:
@@ -121,6 +121,8 @@ namespace Kernel
|
|||||||
|
|
||||||
void NetworkManager::on_receive(NetworkInterface& interface, BAN::ConstByteSpan packet)
|
void NetworkManager::on_receive(NetworkInterface& interface, BAN::ConstByteSpan packet)
|
||||||
{
|
{
|
||||||
|
if (packet.size() < sizeof(EthernetHeader))
|
||||||
|
return;
|
||||||
auto ethernet_header = packet.as<const EthernetHeader>();
|
auto ethernet_header = packet.as<const EthernetHeader>();
|
||||||
|
|
||||||
switch (ethernet_header.ether_type)
|
switch (ethernet_header.ether_type)
|
||||||
|
|||||||
Reference in New Issue
Block a user