Ethernet: Add a length check
authorFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>
Fri, 5 Nov 2021 20:48:31 +0000 (21:48 +0100)
committerFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>
Sun, 21 Nov 2021 15:26:08 +0000 (16:26 +0100)
commitc72751f8cdc8bf0f87d26531d24d74aaddf377f2
tree8dc60304c19feca88893b88b1335777e3a6348bc
parentd52b757efa7b0678e34c0ffe32d1c0da29bbb604
Ethernet: Add a length check

This fix some undefined behaviors at runtime.

The errors were like:

print-ether.c:241:11: runtime error: unsigned integer overflow:
  1 - 2 cannot be represented in type 'unsigned int'
print-ether.c:242:11: runtime error: unsigned integer overflow:
  1 - 2 cannot be represented in type 'unsigned int'

Moreover:
Fix indentation.
print-ether.c