Skip to content

Commit 0ebbb23

Browse files
authored
Check at the start of the function
1 parent ac92d06 commit 0ebbb23

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Packet++/src/UdpLayer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,12 @@ namespace pcpp
160160

161161
void UdpLayer::computeCalculateFields()
162162
{
163-
udphdr* udpHdr = (udphdr*)m_Data;
164163
if (m_DataLen < sizeof(udphdr))
165164
{
166165
PCPP_LOG_ERROR("Buffer too small to calculate fields");
167166
return;
168167
}
168+
udphdr* udpHdr = (udphdr*)m_Data;
169169
udpHdr->length = htobe16(m_DataLen);
170170
calculateChecksum(true);
171171
}

0 commit comments

Comments
 (0)