diff --git a/ethertype-dump.c b/ethertype-dump.c index 402e5a9..3c3280e 100644 --- a/ethertype-dump.c +++ b/ethertype-dump.c @@ -104,6 +104,7 @@ int main(int argc, char **argv) { if (frame_length == -1) { err(1, "recv"); } + size_t frame_data_length = frame_length <= 1522 ? frame_length : 1522; if (frame_length < 64) { errno = 0; @@ -114,7 +115,7 @@ int main(int argc, char **argv) { } // Compute the CRC32 of the frame - uint32_t crc32_residue = crc32(frame, frame_length); + uint32_t crc32_residue = crc32(frame, frame_data_length); if (crc32_residue != 0xc704dd7b) { errno = 0;