mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-11 13:22:33 +00:00
net: fix tail size calculation in Ethernet_frame
The const-variant of the data() method contained an erroneous calculation of the tail size. This led to the size guard throwing exceptions when trying to parse TCP packets that only contained the TCP header. Fixes genodelabs/genode#4340
This commit is contained in:
parent
162ddb1fdb
commit
b1bbd72e84
@ -78,9 +78,8 @@ class Net::Ethernet_frame
|
||||
T const &obj = *(T *)(_data);
|
||||
|
||||
/* Ethernet may have a tail whose size must be considered */
|
||||
Genode::size_t const unconsumed = size_guard.unconsumed();
|
||||
size_guard.consume_tail(unconsumed + sizeof(T) -
|
||||
obj.size(unconsumed));
|
||||
Genode::size_t const max_obj_sz = size_guard.unconsumed() + sizeof(T);
|
||||
size_guard.consume_tail(max_obj_sz - obj.size(max_obj_sz));
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user