Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
ICMPv6: Fix printing the Home Agent Address Discovery Reply Message
Browse files Browse the repository at this point in the history
This change avoids incorrect truncation printing (" [|icmp6]") avoiding
any attempt to get an IPv6 address past the end of the packet data.
It also avoids a pointer overflow with a 32-bit build that stopped IPv6
addresses printing.
(When length is big, e.g. Jumbo Payload).

(cherry picked from commit 66dc8d7)
  • Loading branch information
fxlb committed Mar 3, 2024
1 parent d0999e3 commit 43b5bb0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion print-icmp6.c
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,8 @@ icmp6_print(netdissect_options *ndo,

ND_PRINT(", id 0x%04x",
GET_BE_U_2(dp->icmp6_data16[0]));
cp = (const u_char *)dp + length;
cp = (const u_char *)dp +
ND_MIN(length, ND_BYTES_AVAILABLE_AFTER(dp));
p = (const u_char *)(dp + 1);
while (p < cp) {
ND_PRINT(", %s", GET_IP6ADDR_STRING(p));
Expand Down

0 comments on commit 43b5bb0

Please sign in to comment.