Only read at max 1522 bytes of the 1522 byte buffer
This commit is contained in:
parent
4565c89b59
commit
b009bf6d37
1 changed files with 2 additions and 1 deletions
|
@ -104,6 +104,7 @@ int main(int argc, char **argv) {
|
||||||
if (frame_length == -1) {
|
if (frame_length == -1) {
|
||||||
err(1, "recv");
|
err(1, "recv");
|
||||||
}
|
}
|
||||||
|
size_t frame_data_length = frame_length <= 1522 ? frame_length : 1522;
|
||||||
|
|
||||||
if (frame_length < 64) {
|
if (frame_length < 64) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
@ -114,7 +115,7 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute the CRC32 of the frame
|
// 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) {
|
if (crc32_residue != 0xc704dd7b) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
Loading…
Reference in a new issue