Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UDP_HEADER_SIZE typo #299

Open
wants to merge 1 commit into
base: v1
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pcap4j-core/src/main/java/org/pcap4j/packet/UdpPacket.java
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ public static final class UdpHeader extends AbstractHeader implements TransportH
private static final int LENGTH_SIZE = SHORT_SIZE_IN_BYTES;
private static final int CHECKSUM_OFFSET = LENGTH_OFFSET + LENGTH_SIZE;
private static final int CHECKSUM_SIZE = SHORT_SIZE_IN_BYTES;
private static final int UCP_HEADER_SIZE = CHECKSUM_OFFSET + CHECKSUM_SIZE;
private static final int UDP_HEADER_SIZE = CHECKSUM_OFFSET + CHECKSUM_SIZE;

private static final int IPV4_PSEUDO_HEADER_SIZE = 12;
private static final int IPV6_PSEUDO_HEADER_SIZE = 40;
Expand All @@ -356,10 +356,10 @@ public static final class UdpHeader extends AbstractHeader implements TransportH
private final short checksum;

private UdpHeader(byte[] rawData, int offset, int length) throws IllegalRawDataException {
if (length < UCP_HEADER_SIZE) {
if (length < UDP_HEADER_SIZE) {
StringBuilder sb = new StringBuilder(80);
sb.append("The data is too short to build a UDP header(")
.append(UCP_HEADER_SIZE)
.append(UDP_HEADER_SIZE)
.append(" bytes). data: ")
.append(ByteArrays.toHexString(rawData, " "))
.append(", offset: ")
Expand Down Expand Up @@ -489,7 +489,7 @@ private byte[] buildRawData(boolean zeroInsteadOfChecksum) {

@Override
public int length() {
return UCP_HEADER_SIZE;
return UDP_HEADER_SIZE;
}

@Override
Expand Down