Skip to content

Commit

Permalink
libsystemd-network: add assert about packet length
Browse files Browse the repository at this point in the history
We reject too-short packets in client_receive_message_raw(), so
the packets that dhcp_packet_verify_headers() gets are of sufficient size.
But let's add an assert to clarify this for the reader.

Closes systemd#23223.
  • Loading branch information
keszybz committed Apr 29, 2022
1 parent 9a94baa commit 6f1b457
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/libsystemd-network/dhcp-packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ int dhcp_packet_verify_headers(DHCPPacket *packet, size_t len, bool checksum, ui
size_t hdrlen;

assert(packet);
assert(len >= sizeof(DHCPPacket));

/* IP */

Expand Down

0 comments on commit 6f1b457

Please sign in to comment.