From b5623511c673db28badf5b6f12807af334b47abf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Thu, 4 Jul 2019 12:28:56 +0300 Subject: [PATCH] Handle overlong frames like runt frames --- ethertype-dump.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ethertype-dump.c b/ethertype-dump.c index 4499385..81aa195 100644 --- a/ethertype-dump.c +++ b/ethertype-dump.c @@ -82,6 +82,14 @@ int main(int argc, char **argv) { continue; } + if (frame_length > 1522) { + errno = 0; + if (printf("Overlong frame (%zdB)\n", frame_length) == -1) { + err(1, "printf"); + } + continue; + } + // Extract the MACs // 012345 012345 // dest source