forked from Bananymous/banan-os
Kernel: Don't crash the kernel if packet is smaller than ethernet hdr
This commit is contained in:
parent
a489be0e05
commit
7f0c39fe91
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue