Kernel: Don't crash the kernel if packet is smaller than ethernet hdr

This commit is contained in:
Bananymous 2024-09-19 22:51:55 +03:00
parent a489be0e05
commit 7f0c39fe91
1 changed files with 2 additions and 0 deletions

View File

@ -121,6 +121,8 @@ namespace Kernel
void NetworkManager::on_receive(NetworkInterface& interface, BAN::ConstByteSpan packet)
{
if (packet.size() < sizeof(EthernetHeader))
return;
auto ethernet_header = packet.as<const EthernetHeader>();
switch (ethernet_header.ether_type)