Only read at max 1522 bytes of the 1522 byte buffer

This commit is contained in:
Juhani Krekelä 2019-07-04 01:33:20 +03:00
parent 4565c89b59
commit b009bf6d37
1 changed files with 2 additions and 1 deletions

View File

@ -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;